0

Temperature converter( celsius to fahrenheit)

include <stdio.h> int main() { float celsius, fahrenheit //Get temperature in celsius from the user printf("Enter temperature in celsius:"); scanf(%f,&celsius); //Convert to fahrenheit fahrenheit =(celsius *9 / 5) + 32; //Display the result printf("%.2f celsius =%.2f fahrenheit \n",celsius , fahrenheit ); return 0; }

12th Oct 2025, 8:50 AM
Hadiya Harmain
Hadiya Harmain - avatar
1 Risposta
+ 1
1. Add # before include -> #include <stdio.h> [line 1] 2. Add missing semicolon after variable declaration -> float celsius, fahrenheit; [line 4] 3. Add quotes in scanf format specifier -> scanf("%f", &celsius); [line 8] 4. Add space in printf for better formatting -> printf("%.2f celsius = %.2f fahrenheit\n", celsius, fahrenheit); [line 14]
12th Oct 2025, 10:01 AM
Ferdous 👾
Ferdous 👾 - avatar