ECE DEPARTMENT : NOTICE BOARD

ADVISORY TO STUDENTS (Answer to "Sir, College is there today ?")

Quote :
"If egg is broken by outside force, life ends. If broken by inside force, life begins. Great things always begin from inside force, trust yourself."

Batchwise blogs: -2008 | 2009 | 2010 | 2011 | 2012

Internal Marks Sem-II : | 2011 | 2010 | 2009 |

Intro | Case 1 | Case 2 | Case 3 | Case 4 | Case 5 |

Previous Posts

Thursday, July 08, 2010

Today's C Program

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);
}
    

2 comments:

  1. Sir,
    the output would be :

    celsius:101 Fahrenheit:213

    this is because the for() statement is terminated by semicolon(;)

    ReplyDelete