Format: Font Size 8, Font Face Arial, Single Space: Final Examination
Format: Font Size 8, Font Face Arial, Single Space: Final Examination
Format: Font Size 8, Font Face Arial, Single Space: Final Examination
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>
int main()
{
float a=2.54,num1,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
#include <iostream>
#include<iomanip>
int main()
{
float radius, volume, surface,pi=3.14159,height;
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.
#include <iostream>
int main()
{
float weight, kilo,pounds=2.2;
pounds=kilo*2.20462;
cout<<"Weight in kilogram: ";
cout<<kilo;
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)
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;