+ 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 .

24th Nov 2023, 2:55 PM
sruthi m
6 odpowiedzi
+ 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
24th Nov 2023, 3:02 PM
Justice
Justice - avatar
+ 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.
24th Nov 2023, 4:13 PM
Ayush Raj
+ 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
26th Nov 2023, 12:57 PM
Arpit Kumar (AK)
Arpit Kumar (AK) - avatar
0
sruthi m in my compiler it working perfectly!
24th Nov 2023, 3:20 PM
Alhaaz
Alhaaz - avatar
0
sruthi m there is no error in your code, it is executing properly
24th Nov 2023, 6:26 PM
Ayush Singh
Ayush Singh - avatar
0
Bro look The code is working. Just enter 3 numbers and make sure to jump a new line like that : 3 6 8
24th Nov 2023, 10:02 PM
Hamza A Foji
Hamza A Foji - avatar