+ 3
what is the error in this code ?
#include <stdio.h> #include <stdlib.h> int main(void) { float num1 ,num2,num3,average; printf("enter 3 numbers "); scanf ("%f%f%f",&num1,&num2,&num3) ; average=(num1+num2+num3)/3; printf("average of 3 numbers is :%f",average); /* prints !!!Hello World!!! */ return EXIT_SUCCESS; } error might be simple though i found it difficult to solve as a beginner .please help me .
6 Respuestas
+ 1
It's a bit hard to read code when it is formatted like that. I recommend using the tutorial in the code bit used below to help format your question better:
https://code.sololearn.com/Wek0V1MyIR2r/?ref=app
+ 1
I found that there is no error in the above program. Please run the above program once again.Sometimes some glitch can also happen but the above program is working .
I hope I answered your question.
+ 1
Hey,
This is the error:
scanf ("%f%f%f",&num1,&num2,&num3) ;
Take inputs separately. The compiler is confused. It can't understand where the first and second inputs end.
TAKE INPUTS SEPERATELY
0
sruthi m in my compiler it working perfectly!
0
sruthi m there is no error in your code, it is executing properly
0
Bro look
The code is working.
Just enter 3 numbers and make sure to jump a new line like that :
3
6
8