Saturday 31 October 2015

IfElse ,Convert Farhenheit Into Celsius And Celsius Into Farhenheit C:Program


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

void main()

{

char o;

float f,c;

clrscr();

printf("Enter (f) For Finding Fahrenheit Value \n Enter (c) For Finding Celcius Value:");

 scanf("%ch",&o);

 switch(o)

{
 case 'f':
printf("Enter Temperture In Celcius:");

 scanf("%f",&c);

 f=9.0/5.0*c+32;

 printf("Fahrenheit Temperture Is : %f",f);

 break;

 case 'c':

 printf("Enter Temperture In Fahrenheit:");

 scanf("%f",&f);

 c=(f-32)*5/9;

 printf("Celcius Temperture Is : %f",c);

 break;
 default:

 printf("Wrong Input,Type f for Farhenheit And c for Celsius");

 }

 getch();
 }


0 comments:

Post a Comment