Monday, March 26, 2012

Program to convert temperature from celsius to fahrenheit & vice versa


/*****************<soeasyprograms.blogspot.in>******************/
 #include<stdio.h>
#include<conio.h>
void main()
{
   int num;
   float cel,cel1,fehren,fahren1;
   clrscr();

 printf("Press 1 to convert celius to fahrenheit & any other number to convert fahrenheit to celsius\n");
 scanf("%d",&num);

 if(num==1)
 {
  printf("Enter temperature in celsius\n");
  scanf("%f",&cel);
  fahren1=32+(cel*1.8);
  printf("Temperature in fahrenheit is %f ",fahren1);
   }
 else
 {
   printf("Enter temperature in fahrenheit ");
   scanf("%f",&fehren);
   cel1=(fehren-32)/1.8;
   printf("Temperature in celsius is %f ",cel1);
   }
  getch();
   }
/*End of program*/
/*****************<soeasyprograms.blogspot.in>******************/


No comments:

Post a Comment