A difficulty about C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

A difficulty about C

When I try to write a simple C program with iPad, but if I use “scanf” statement and then click RUN to run. System always show me Looks like your program has no input. How can I solve this problem. #include <stdio.h> int main() { int a,b,sum; printf("Please input a,b:\n"); scanf("%d%d",&a&b); sum=a+b; printf("%d",sum); return 0; } These code is only to help me test software. I’m a new learner.

9th Jan 2018, 4:50 PM
tnak
7 Answers
+ 2
use comma between &a and &b just like this (&a,&b);
10th Jan 2018, 9:24 AM
Awanish Kumar Srivastava
Awanish Kumar Srivastava - avatar
+ 1
can you show us the code?
9th Jan 2018, 4:53 PM
emmey
emmey - avatar
+ 1
thanks emmey
10th Jan 2018, 4:38 PM
Awanish Kumar Srivastava
Awanish Kumar Srivastava - avatar
0
show me your source code
9th Jan 2018, 4:56 PM
Awanish Kumar Srivastava
Awanish Kumar Srivastava - avatar
0
No, use comma can’t solve it. Maybe App doesn’t support the function of “scanf()”
10th Jan 2018, 9:57 AM
tnak
0
Awanish is right. That is the only issue. Other than that the code runs fine. put a , between them in the scanf line.
10th Jan 2018, 4:28 PM
emmey
emmey - avatar
0
Oh, yeah! I get it. Thanks Avi Srivastava and Emmey.
11th Jan 2018, 1:47 AM
tnak