100% found this document useful (1 vote)
222 views3 pages

CSC425 Surface Area and Volume of A Cylinder

The document provides instructions for a lab assignment to write pseudo-code, draw a flowchart, and develop a C++ program to calculate and output the surface area and volume of a cylinder. It gives the formulas for volume and surface area of a cylinder in terms of radius, height, and pi. The algorithm and C++ program implement these formulas by taking radius and height as input, calculating volume and surface area using the constants pi=3.14159, and outputting the results.

Uploaded by

Eve Shrly
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
100% found this document useful (1 vote)
222 views3 pages

CSC425 Surface Area and Volume of A Cylinder

The document provides instructions for a lab assignment to write pseudo-code, draw a flowchart, and develop a C++ program to calculate and output the surface area and volume of a cylinder. It gives the formulas for volume and surface area of a cylinder in terms of radius, height, and pi. The algorithm and C++ program implement these formulas by taking radius and height as input, calculating volume and surface area using the constants pi=3.14159, and outputting the results.

Uploaded by

Eve Shrly
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/ 3

CSC425

INTRODUCTION TO COMPUTER PROGRAMMING

Lab Assignment

Write the pseudo-code, draw the flowchart and write a complete C++ program to compute
and display the surface area and volume of a cylinder.

The formula for a cylinder with radius r and height h is given:

volume=  x r x r x h, where  is 3.14159

surface_area = 2 x  x r x (r + h)
Algorithm:

START

Readradius, height,
volume, surface_area,
pi=3.14159

Volume = pi*radius*radius*height
Surface_area= 2*pi*radius*(radius+height)

Print volume, surface_area

END
C++ Program:
/*
Name:
Sid# :
Course: CSC425
Group#:
Assign#: Assignment
Program Description: C++ program to compute and display the surface area
and volume of a cylinder.
*/

#include <cmath>
#include <iostream>
using namespace std;

int radius;
int height;
int volume;
int surface_area;
float pi=3.14159;

int main ()
{
cout<<" Enter radius"<<endl;
cin>>radius;
cout<<" Enter height"<<endl;
cin>>height;

volume= pi*radius*radius*height;
cout<<"Volume of cylinder is"<<volume<<endl;

surface_area= 2*pi*radius*(radius+height);
cout<<" Surface area of cylinder is "<<surface_area<<endl;

return 0;
}

You might also like