Pages

Convert temprature from Farnhieght to CELSIES and Celcies to farnhiegh

Friday 19 April 2013

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

 

Search Box

Most Reading

Contact Form

Name

Email *

Message *