You are on page 1of 4

Republic of the Philippines

Don Honorio Ventura State University


Villa de Bacolor, Pampanga

College of Engineering and Architecture


CFP 112 -COMPUTER FUNDAMENTALS AND PROGRAMMING
Laboratory – FINALS_ASSIGNMENT2

Name: Christian Evan C. Centeno Score: ____________


Course/Year/Sec: BSCE-1B Date: 05/19/2022

1. Create an algorithm, flowchart and program to compute the volume of a sphere. Use the
formula: V = (4/3) *pi*r3 where pi is equal to 3.1416 approximately. The r is the radius of
sphere. Display the result.

Algorithm
1. Start
2. Read r Program
3. vol=(4/3)*pi*r*r*r
4. print or display vol
5. stop #include <stdio.h>
#define pi 3.1416
Flowchart

int main()
Start {

int r;
Read r
float vol;

printf("Enter radius of sphere:\n");


vol=(4/3) *pi*r*r*r scanf("%d", &r);

vol= (4/3)*pi*r*r*r;
Read r

printf("Volume of sphere is: %f", vol);

}
Stop
2. Create an algorithm, flowchart and a program the converts the input Celsius degree
into its equivalent Fahrenheit degree. Use the formula: F = (9/5) *C+32.

Algorithm
1.start
2.Initialize F=0, C=0 Program
3.read C #include<stdio.h>
4.Fh=(1.8*C) + 32
5.Print or display Fh int main()

6.stop {

Flowchart float C;

float Fh;
Start
printf("Enter temperature in Celsius:\n");

scanf("%f", &C);

C=0, F=0 Fh = (1.8*C)+32;

printf("Fahrenheit value is: %f", Fh);

Read C
}

Fh=(1.8*C) + 32

Write Fh

Stop
3. Create an algorithm, flowchart and a program that converts the input dollar to its
peso exchange rate equivalent. Assume that the present exchange rate is 50.00
pesos against the dollar. Then display the peso equivalent exchange rate.
Algorithm
1.Start
2.Read dollar
3.peso = dollar *50.00 Program
4. Print or display peso
5. stop #include<stdio.h>

Flowchart
int main()

{
Start
float dollar;

Read dollar float peso;

printf("Enter No. of dollars to convert:\n");

scanf("%f", &dollar);
Peso = dollar*50.00

peso = dollar*50.00;

printf("Equivalent peso is: %f", peso);


Write peso
}

Stop
4. Create an algorithm, flowchart and a program that converts an input inch(es) into its
equivalent centimeters. Take note that one inch is equivalent to 2.54cms.

Algorithm
1.start Program
2.Read inch
3.cm= 2.54*inch #include<stdio.h>
4. Print or display cm
5.Stop int main()

{
Flowchart float inch;

Start
float cm;

printf("Enter inches:\n");
Read inch
scanf("%f", &inch);

Cm= 2.54*inch cm = 2.54* inch;

printf("Equivalent cm is: %f", cm);

}
Write cm

Stop

You might also like