0% found this document useful (0 votes)
18 views6 pages

Format: Font Size 8, Font Face Arial, Single Space: Final Examination

The document is a final exam for a student named DUMALAG JOSHUA D. It consists of 4 programming problems worth various point values totaling 100 points. For each problem, the student wrote code and provided screenshots of the output to solve the problems presented. The problems include: 1) Converting height in inches to centimeters. 2) Calculating the volume and surface area of a cylinder. 3) Converting weight between kilograms and pounds. 4) Summing input numbers until -999 is entered, using a while loop. The student's solutions and outputs are shown for grading.

Uploaded by

Josh Dumalag
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)
18 views6 pages

Format: Font Size 8, Font Face Arial, Single Space: Final Examination

The document is a final exam for a student named DUMALAG JOSHUA D. It consists of 4 programming problems worth various point values totaling 100 points. For each problem, the student wrote code and provided screenshots of the output to solve the problems presented. The problems include: 1) Converting height in inches to centimeters. 2) Calculating the volume and surface area of a cylinder. 3) Converting weight between kilograms and pounds. 4) Summing input numbers until -999 is entered, using a while loop. The student's solutions and outputs are shown for grading.

Uploaded by

Josh Dumalag
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/ 6

FINAL EXAMINATION

Format: Font Size=8, Font Face=Arial, Single Space


Name: DUMALAG JOSHUA D SECTION: 1-BSCS-3

Select the machine problem with corresponding score. If the chosen machine problem having syntax or
logical errors the score is automatically ZERO. Passing Score 70/100

GRADE PROBLEM
25 Write a program that asked the user to input height in inches and then display the height in
centimeter. (1inch = 2.54centimeter)
CODE OUTPUT (SCREENSHOT)

#include <iostream>

using namespace std;

int main()
{
float a=2.54,num1,value;

cout<<"Input Height: ";


cin>>num1;

num1= num1* 2.54 ;


value= num1;
cout<<value;

return 0;
}
25 2. Program prompts the user to input the height and the radius
of the base of a cylinder and outputs the volume and surface
area of the cylinder
VOLUME = PI * radius2 * height
SURFACE AREA: =2 * radius * 2 * PI * radius2

CODE OUTPUT (SCREENSHOT)

#include <iostream>
#include<iomanip>

using namespace std;

int main()
{
float radius, volume, surface,pi=3.14159,height;

cout<<"Enter radius :";


cin>>radius;
cout<<"Enter height :";
cin>>height;

volume = pi * (radius*radius) * height;


surface= 2 * radius * 2 * pi * (radius*radius);

cout<<volume;
cout<<endl;
cout<<surface;

return 0;
}
25 3. Write a program that prompts the user to enter the weight of
a person in kilograms and outputs the equivalent weight in
pounds. Output both the weights rounded to two decimal
places.

CODE OUTPUT (SCREENSHOT)

#include <iostream>

using namespace std;

int main()
{
float weight, kilo,pounds=2.2;

cout<<"Enter Weight in kilogram: ";


cin>>kilo;

pounds=kilo*2.20462;
cout<<"Weight in kilogram: ";
cout<<kilo;

cout<<"\nWeight in pounds: ";


cout<<pounds;

return 0;
}

50 3. Write a program to read in numbers until the number -999 is encountered. The sum of
all number read until this point should be printed out. (USING WHILE STATEMENT)

CODE OUTPUT (SCREENSHOT)


#include <iostream>

using namespace std;

int main()
{
float input;
float sum =0;
input =0;
while(input !=(-999))
{
cout<<"Please Enter number: ";
cin>>input;
sum+= input;
if(input== (-999))
{
sum = sum+ 999;
}
else
continue;
}
cout<<"Sum of entered number : ";
cout<<sum;

You might also like