0

Is this code correct?

#include <stdio.h> #include <conio.h> main() { float C,F ; printf ("Enter the number of Centigrade : ") ; scanf (" %f ", &C); F = 9*C/5+32; printf ("The value of Farenheight is % 2f\n ", F); return 0 }

23rd Sep 2024, 2:10 AM
Mizan
Mizan - avatar
3 Answers
+ 5
Remove conio.h The return type of main is int. So it should be: int main(){ } Use lowercase for your variables. capitals are usually used for constants. Add a semicolon to the end of return 0 return 0; Centigrade is an old term. Celsius is the modern unit. You should add a dot in front of 2 in your float format specifier printf("The value of Fahrenheit is %.2f\n", f); Fahrenheit not Farenheight.
23rd Sep 2024, 2:40 AM
Bob_Li
Bob_Li - avatar
+ 2
Thanks
23rd Sep 2024, 4:04 AM
Mizan
Mizan - avatar
+ 1
It looks like you are using an earlier version of c computer.
23rd Sep 2024, 9:25 AM
Oliver Pasaribu