Convert temprature from Farnhieght to CELSIES and Celcies to farnhiegh

4/20/2013 01:34:00 am Unknown 0 Comments

#include <stdio.h>

#include <conio.h>

main()
{
      char scale;
      int temp=0;
      float ans;
      printf("Enter F to convert Farnhieght to CELSIES.\nEnter C to convert Celcies to farnhiegh.");
      scale=getche();
      printf("\n");
      if(scale=='F' || scale=='f')
      {
                    printf("Enter temperature in farnhieght: ");
                    scanf("%d", &temp);
                    ans=(temp-32)*5/9;
                    printf("%dF celsies is = %fC \n", temp, ans);                    
      }
      else
      {
                         printf("Enter temperature in celsies: ");
                    scanf("%d", &temp);
                    ans=temp*(9/5)+32;
                 
                    printf("%dC celsies is = %fF",temp, ans);
                    }
 getch();  
}