Monday 2 July 2012

Basic C Programming002


Fahrenheit to Centigrade conversion.

#include <stdio.h>
#include <conio.h>
void main ( )
{
        float       c, f ;
        clrscr ( );
                       
        printf ("\n Enter the temperature in Fahrenheit : -"); scanf ("%f",&f);
                           
        c = ( ( f - 32 ) * 5 ) / 9;
                     
        printf ("\n Temperature in Centigrade is : - %f", c);
               
        getch ( );
Centigrade to Fahrenheit conversion. 

 #include <stdio.h>
#include <conio.h>

void main ( )
{
         float       c, f ;
         clrscr ( );
                     
         printf ("\n Enter the temperature in Centigrade : -"); scanf ("%f",&c);
                         
         f = ( c * 9 + 160 ) / 5;
                      
         printf ("\n Temperature in Fahrenheit is : - %f", f);
                      
         getch ( );
}

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...