You are on page 1of 3

SERDAN, MICHAEL JOHN B.

 
CEIT-37-101A 
COMPROG LAB (ITC111L) MWF 09:00-10:30AM 
COMPROG (ITC111) TH 04:30-07:30PM
 
LABORATORY EXERCISE #11 – Mathematical Functions
Instructions: Prepare Program Plan, Algorithm, draw Flowchart and create a program that
converts temperature from Fahrenheit to Celsius.

EXERCISE #11 LAYOUT

PROGRAM PLAN 
Required Output temperature in Celsius = cels
Available Input temperature in Fahrenheit = fahr
Processing  cels = (fahr - 32) * 5 / 9;
Requirements

ALGORITHM
1. Start
2. Initialize Variables: cels = 0, fahr = 0;
3. Print " Input temperature in Fahrenheit : ";
4. Input fahr;
5. Calculation to get the Celsius
6. cels = (fahr - 32) * 5 / 9;
7. Print system clear;
8. Print " Input temperature in Fahrenheit : ";
9. Print fahr;
10. Print " The converted temperature in Celsius is : ";
11. Print cels;
12. Print " C";
13. End.
FLOWCHART
C++ PROGRAM
#include <iostream>
#include <iomanip>
//This program converts temperature from Fahrenheit to Celsius.
using namespace std;
int main ()
{
//Variables
float cels, fahr;
//To be Input
cout << "\n Input temperature in Fahrenheit\t\t: ";
cin >> fahr;
//Calculation to get the Celsius
cels = (fahr - 32) * 5 / 9;
//Precision for Decimal Numbers
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout << setprecision(2);
//System clear
system ("cls");
//Screen Layout
cout << "\n Input temperature in Fahrenheit\t\t: " << fahr << "\n\n";
cout << " The converted temperature in Celsius is \t: " << cels << " C" << "\n";
return 0;
}

C++ SCREEN LAYOUT

You might also like