0
Please check my code, when i run it 1st and second printf sentence are not appeare and a and b var 's value can not inputted...
#include <stdio.h> main() { int a,b; int c=a+b; printf ("enter the first number"); scanf("%d",a); printf ("enter the second number "); scanf ("%d",b); printf ("the sum of numbers are:%d",c); }
1 ответ
+ 10
First, read about how to take input from user.
https://www.sololearn.com/learn/C/2914/
You forgot to use the address operator in scanf() function.
Second, you didn't initialise the variables "a" and "b" yet. So you can not add those two variables and assign them to "c"
This is your modified code.
#include <stdio.h>
int main() {
int a,b;
printf ("enter the first number");
scanf("%d", &a);
printf ("enter the second number ");
scanf ("%d", &b);
int c=a+b;
printf ("the sum of numbers are:%d",c);
return 0;
}