Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Project temp.c - NAME; ID
- #include <stdio.h>
- #include <conio.h>
- #include <dos.h>
- #include <math.h>
- #include <string.h>
- int main()
- {
- float f, c, a1, a2;
- int choice;
- printf("Project temp.c - NAME; ID");
- printf("nnProgram to convert degrees in Fahrenheit to Celsius");
- printf("nn1) Fahrenheit to Celcius");
- printf("n2) Celcius to Fahrenheit");
- printf("n3) Just want to exit the program");
- printf("nnEnter your choice 1, 2, or 3: ");
- scanf("%d", &choice);
- if(choice == 1)
- {
- printf("nEnter the degrees in Fahrenheit: ");
- scanf("%f", &f);
- a1= (f-32)*5/9; /*conversion for Fahrenheit to Celcius*/
- printf("n**************************");
- printf("nOriginal Temperature in Fahrenheit: %0.2f", f);
- printf("nTemperature converted to Celcius: %0.2f", a1);
- printf("n**************************");
- }
- else if(choice == 2)
- {
- printf("nEnter the degrees in Celcius: ");
- scanf("%f", &c);
- a2= c*1.8+32; /*conversion for Celcius to Fahrenheit*/
- printf("n**************************");
- printf("nOriginal Temperature in Celcius: %0.2f", c);
- printf("nTemperature Converted to Fahrenheit: %0.2f", a2);
- printf("n**************************");
- }
- else if(choice == 3)
- {
- printf("nnPress Enter to exit ...n");
- getche();
- return 0;
- }
- printf("nnPress Enter to exit ...n");
- getche();
- return 0;
- }
Add Comment
Please, Sign In to add comment