Ads 468x60px

Labels

Thursday, 6 September 2012

First C Program


Open command prompt
C:\TC\BIN > TC.EXE
Select New from the File menu.
Type the program in the editor.

#include <stdio.h>
int main( )
{
/*Calculate the Simple Interest*/
/*si = pnr/100*/
int p, n ;
float r, si ;
p = 1000 ;
n = 3 ;
r = 8.5 ;
/* formula for simple interest */
si = p * n * r / 100 ;
printf ( "%f" , si ) ;
return 0;
}

Save the program using F2 under a proper name (say Program Hello.c).
Use Ctrl + F9 to compile and execute the program.
Use Alt + F5 to view the output.