-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask 12.c
More file actions
27 lines (27 loc) · 842 Bytes
/
task 12.c
File metadata and controls
27 lines (27 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*WRITE A C PROGRAM TO DISPLAY THE FOLLOWING OPTIONS : 1. CELCIUS TO FAHRENHEIT,
2. FAHRENHEIT TO CELCIUS, 3. EXIT. PERFORM THE RELEVANT OPERATION USING SWITCH CASE.
*/
#include<stdio.h>
void main()
{
float c,f;int ch;
printf("Enter: \n1. CELCIUS TO FAHRENHEIT\n2. FAHRENHEIT TO CELCIUS\n3. EXIT.\n");
scanf(" %d",&ch);
switch(ch)
{
case 1:printf("\nEnter temerature in the celcius: ");
scanf("%f",&c);
f=(c*(9/5.0))+32;
printf("Fahrenheit: %f",f);
break;
case 2:
printf("\nEnter temerature in the Fahrenheit: ");
scanf("%f",&f);
c= 5 * (f - 32)/9;
printf("Celcius: %f",c);
break;
case 3:printf("\nExit..........");
break;
default: printf("Wrong choice.....");
}
}