0

I'm testing c program on Visual Studio Code in Windows. I have installed the extensions in the Visual Studio Code: C/C++ from Microsoft; & Code Runner.

I have written a c program that will take two numbers as input from the user and print the sum as output.

C program code:

# include<stdio.h>
void main(){
    float n1, n2;
    
    printf("Enter 1st number: ");
    scanf("%f",&n1);

    printf("Enter 2nd number: ");
    scanf("%f",&n2);

    printf("Sum of %f + %f = %0.2f",n1,n2,n1+n2);
    return;
}

When I'm trying to execute this code on Visual Studio Code, I'm not getting any output(not even the statement "Enter 1st number") or error message. But, when I'm trying to run the code directly using the command prompt, the code is running successfully.

Can anyone please help me to understand, what can be the possible issue that the code is not running on Visual Studio Code, and how can I fix that issue?

Yash
  • 57
  • 1
  • 10
  • Never used it, but I did a simple web search, which turned up a guy's [video](https://www.youtube.com/watch?v=Si8rN5J249M) about it. In short: (1) File > Preferences > Settings; (2) search for code runner; (3) Find "Run in Terminal" setting and check it. Time stamp 3:25. – paddy Nov 10 '21 at 05:15
  • Thanks for sharing the video link :) The video has solved my issue – Yash Nov 10 '21 at 05:57

0 Answers0