What does the following program print ?
#include "stdio.h"
/*
* Thi program produces a Celsius to Fahrenheit conversion
* chart for the numbers 0 to 100.
*/
/* The current Celsius temperature we are working with */
int celsius ;
int main ( ) {
for (celsius = 0; celsius <= 100; ++celsius);
printf("Celsius:%d Fahrenheit: %d\n",
celsius, (celsius * 9) / 5 + 32);
return (0);
}
ADVISORY TO STUDENTS (Answer to "Sir, College is there today ?")
Quote :
Previous Posts
Thursday, July 08, 2010
Subscribe to:
Post Comments (Atom)
Sir,
ReplyDeletethe output would be :
celsius:101 Fahrenheit:213
this is because the for() statement is terminated by semicolon(;)
Correct Sai well done!
ReplyDelete