During a class we started learning C, all of the tasks that I was given I managed to do expect when the scanf tasks came, after I couldn’t make it work, I copied the code from the professor and I still couldn’t make it work.
I am using vs code, code runner extension and gcc on ubuntu linux.
Here is the code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b;
scanf("%d", &a);
scanf("%d", &b);
printf("Zbir je %d\n", a+b);
return 0;
}
Here is the output, it does not stop untill I press the stop button:
Output
>Solution :
The code looks fine. You might want to change a setting in vs-code to run code in an integrated terminal.
Go to File ->Preference -> Settings. Add the following code:
{
"code-runner.runInTerminal": true
}