T-4(2-B) - centigrade\npress'f for cetrigrade to farenhiet" choice=getche switch(choice case'k ans=ctok(temp printf"\n%f",ans break

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#define ctok(x) (x+273) #define ftoc(x) (5.0/9*(x-32)) #define ctof(x) (9.0/5*x+32) #include<stdio.h> #include<conio.h> # void main(void) { float temp,ans; char choice; clrscr(); printf("Enter the tempreture which you want convert: "); scanf("%f",&temp); printf("press 'k' for centigrade to kelvin\npress 'c' for farenhiet to
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: centigrade\npress 'f' for cetrigrade to farenhiet "); choice=getche(); switch(choice) { case 'k': ans=ctok(temp); printf("\n%f",ans); break; case 'f': ans=ftoc(temp); printf("\n%f",ans); break; case 'c': ans=ctof(temp); printf("\n%f",ans); break; default: printf("\nInvalid choice"); } getch(); }...
View Full Document

This note was uploaded on 11/06/2010 for the course UBIT 411 taught by Professor Saleemelahi during the Spring '10 term at University of Karachi.

Ask a homework question - tutors are online