Home > Mobile >  How I run C progamme with Input in Netbeans
How I run C progamme with Input in Netbeans

Time:09-23

I try This code

#include <stdio.h>

   int main() { 
        int testInteger;
        printf("Enter an integer: \n");
        scanf("%d", &testInteger);  
        return 0;
    }

But in Netbeans, I can't Run this code because It only blank output

Like this

I have same err in VS code but I fix it with run in terminal

Can you help me

CodePudding user response:

try this code Add a space in scanf

#include <stdio.h>

   int main() { 
        int testInteger;
        printf("Enter an integer: \n");
        scanf(" %d", &testInteger);  
        return 0;
    }

CodePudding user response:

This problem is about Netbean's internal terminal/console section. The internal console is not able to run scanf function. So use an external terminal for your project. To do this:

first right click on your project, and select properties. In that window select "Run" tab at the bottom. in there, there is "Console Type", change this console type from "internal terminal" to "external terminal". That is all.

  • Related