+ 2
Why scanf doesn't work in the c compiler provided in sololearn?
scanf command takes input values. https://code.sololearn.com/c69Fs7d2A26X/?ref=app
5 Answers
+ 4
#include <stdio.h>
int main() {
float a, b;
printf("Enter 2 numbers to find their sum.\n");
scanf("%f %f",&a, &b);
float sum=a+b;
printf("Sum of a and b is %f.\n", sum);
return 0;
}
+ 2
working you only forgot to put "&" ,infront of a,b
scanf("%f %f",&a,&b);
+ 2
It works
ur code is wrong
#include <stdio.h>
int main() {
float a, b;
printf("Enter 2 numbers to find their sum.\n");
scanf("%f %f", &a, &b);
float sum=a+b;
printf("Sum of a and b is %f.\n", sum);
return 0;
}
+ 1
This is corrected code
enter two values in pop up and separate them by pressing enter
+ 1
Thanks!! My mistake!!