0% found this document useful (0 votes)
13 views

prac 4

The document outlines a practical activity for converting temperatures between Celsius and Fahrenheit using C programming. It includes objectives, algorithms, flowcharts, and sample code for both conversions. The student, Bilal Ahmed Khan, is expected to demonstrate input and output data handling in C language.

Uploaded by

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

prac 4

The document outlines a practical activity for converting temperatures between Celsius and Fahrenheit using C programming. It includes objectives, algorithms, flowcharts, and sample code for both conversions. The student, Bilal Ahmed Khan, is expected to demonstrate input and output data handling in C language.

Uploaded by

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

Computer Science Practical: X

Name: Bilal Ahmed Khan Grade: XA

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.

Fill the sections below as evidence of the practical activity.

Algorithm Flowchart

Celsius to Fahrenheit Celsius to Fahrenheit Fahrenheit to Celsius

Step 1: Start
Step 2: Input C
Step 3: F=C*1.8-32
Step 4: Print F
Step 5: Stop

Fahrenheit to Celsius

7
Computer Science Practical: X

Name: Bilal Ahmed Khan Grade: XA


Step 1: Start
Step 2: Input F
Start Start
Step 3: C=(F-32)/1.8
Step 4: Print C
Input C Input F
Step 5: Stop

F=C*1.8-32 C=(F-32)/1.8

Print F Print F

Stop Stop

Program Coding

Celsius to Fahrenheit Fahrenheit to Celsius

#include <stdio.h> #include <stdio.h>

int main() int main()


{ {
float celsius, fahrenheit; float fahrenheit, celsius;
printf("Enter temperature in Celsius: "); printf("Enter temperature in Fahrenheit: ");
scanf("%f", &celsius); scanf("%f", &fahrenheit);
fahrenheit = (celsius * 1.8) - 32; celsius = (fahrenheit - 32) / 1.8;
printf("Temperature in Fahrenheit: %.2f\n", printf("Temperature in Celsius: %.2f", celsius);
fahrenheit);
return 0;
return 0;
}
}

8
Computer Science Practical: X

Name: Bilal Ahmed Khan Grade: XA


Program Output

Celsius to Fahrenheit Fahrenheit to Celsius

You might also like