Professional Documents
Culture Documents
LE1 Viado
LE1 Viado
Laboratory Exercise
Name
Date
Section
1/19/2016
A2
Problem Statement:
1.) The perimeter, approximate surface area, and the approximate volume of an in
ground pool is given by the following formula:
Perimeter = 2(length + width)
Underground surface area = 2(length + width) x average depth + (length x width)
Volume = (length x width) x average depth
Design a flowchart and a C++ program that prompts the user to input value for
length, width, and average depth. Calculate and output the perimeter,
underground surface area, and volume of the swimming pool.
2.) Design a flowchart and a C++ program that will input the numerators and
denominators of the two fractions. Compute and output the product of the two
fractions as a fraction and as a percent.
Sample:
Input:
Output:
Numerator 1 = 1
Denominator 1 = 5
Numerator 2 = 3
Denominator 2 = 8
Product of two fractions as a fraction = 3/40
Product of two fractions as percent = 7.5%
3.) Design a flowchart and a C++ program that will input values to variable E, X, I,
and T. Get their ones digit and compute and output the sum.
Sample:
Input:
Output:
E = 12
X= 628
I= 3
T= 10203
Sum of the ones digit of E, X, I, and T = 16
Criteria
1.)
2.)
3.)
4.)
5.)
6.)
7.)
8.)
9.)
10.)
Score
Total
_______________________
Engr. Cristina A. Pascua
5
5
20
5
5
20
5
5
20
10
100
_______________
Date
Name
1
Viado, Emmanuel Russell P.
Date
Section
1/19/2016
A2
2.)
C++ Program
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
float Num1, Num2, Den1, Den2, Prod1, N, D, P, ND;
cout<<"Numerator 1 = ";
cin>>Num1;
cout<<"Numerator 2 = ";
cin>>Num2;
cout<<"Denominator 1 = ";
cin>>Den1;
cout<<"Denominator 2 = ";
cin>>Den2;
N = Num1*Num2;
D = Den1*Den2;
ND = N/D;
cout<<"\n\n\n";
cout<<"Answer in Fractionn"<<"\n\n\n";
cout<< N <<"/"<<D<<"\n\n\n";
P = ND*100;
cout<<"Answer in Percentage = "<<P<<"\n\n\n";
system("pause");
return 0;
}
3.)
C++ Program
#include <iostream>
using namespace std;
int main ()
{
int E, X, I, T, S;
cout<<"Input the Values of : "<<"\n\n\n"
cout<<"E = ";
cin>>E;
cout<<"X = ";
cin>>X;
cout<<"I = ";
cin>>I;
cout<<"T = ";
cin>>T;
S = E % 10 + X % 10 + I % 10 + T % 10;
cout<<"Sum of the one's digit = "<<S<<"\n\n\n";
system("pause");
return 0;
}