Prac 4
Prac 4
SLO No 9.2.2
SLOs Mapped 8.3.2, 9.1.1,9.1.2,9.1.3,9.1.5,9.2.2,9.2.3,9.2.4
Practical Activity To convert Celsius to Fahrenheit temperature and vice versa
Equipment Computer
Software Dev C++
Practical No 4
Topic 9: Fundamental of input and output data handling in C
Objective:
Students will be able to
use the arithmetic operators and input output data handling in C language to solve the given
arithmetic problem.
7
Computer Science Practical: X
Flowchart
Celsius to Fahrenheit Fahrenheit to Celsius
Code
Celsius to Fahrenheit Fahrenheit to Celsius
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
int main () int main() {
{ float celsius,fahrenheit;
float celsius, fahrenheit; printf("Enter the fahrenheit:");
printf ("Enter the celsius:"); scanf("%f",& fahrenheit);
scanf ("%f", &celsius); celsius=(5.0/9)*(fahrenheit-32);
fahrenheit= (celsius*9.0/5) +32; printf("celsius:%.2f",celsius);
printf ("fahrenheit: %.2f", fahrenheit); return 0;
return 0; }
}
Output
Celsius to Fahrenheit Fahrenheit to Celsius