[go: up one dir, main page]

0% found this document useful (0 votes)
12 views2 pages

Prac 4

The document outlines a practical activity for converting temperatures between Celsius and Fahrenheit using C programming. It includes objectives, sample inputs and outputs, algorithms, flowcharts, and code examples for both conversions. Students are expected to utilize arithmetic operators and input/output handling in C to complete the task.

Uploaded by

dua186641
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Prac 4

The document outlines a practical activity for converting temperatures between Celsius and Fahrenheit using C programming. It includes objectives, sample inputs and outputs, algorithms, flowcharts, and code examples for both conversions. Students are expected to utilize arithmetic operators and input/output handling in C to complete the task.

Uploaded by

dua186641
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Computer Science Practical: X

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.

Note: You can use any compiler for program execution.

Celsius to Fahrenheit Fahrenheit to Celsius


Sample Input Process Sample Output Sample Input Process Sample Output
52 F=(C*9.0/5) +32 52 C = 125.6 F 65 C=(5.0/9) *(F-32) 65 F = 18.333 C

Fill the sections below as evidence of the practical activity.


Algorithm
Celsius to Fahrenheit Fahrenheit to Celsius
Step1: Start Step1: Start
Let the Temperature in Celsius, C be Let the Temperature in Fahrenheit, F
100 be 100
Step2: Calculate the Temperature in Step2: Calculate the Temperature in
Fahrenheit Celsius
F=(C*9.0/5) +32 C=(5.0/9)*(F-32)
Step3: Output F Step3: Output Volume
Step4: Stop Step4: Stop

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

You might also like