Assignment csc
-
Upload
atie-iekah -
Category
Documents
-
view
220 -
download
0
description
Transcript of Assignment csc
![Page 1: Assignment csc](https://reader036.fdocuments.in/reader036/viewer/2022082822/5695cffd1a28ab9b02906ea8/html5/thumbnails/1.jpg)
QUESTION AREA & VOLUME
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
double Area,Volume;
float r,h;
cout<<"This program will calculate the area of a circle "<<endl;
cout<<"and the volume of a cylinder"<<endl<<endl;
cout<<"Please enter the radius of a circle"<<endl;
cin>>r;
cout<<endl;
cout<<"Please enter the height of a cylinder"<<endl;
cin>>h;
Area=3.142*r*r;
Volume=3.142*r*r*h;
cout<<"Area of the circle is "<<Area<<endl;
cout<<"Volume of the cylinder is "<<Volume<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Pseoducode :
Start
Insert r and h
Area= 3.142 x r x r
Volume= 3.142 x r x r x h
Print Area and volume
End
![Page 2: Assignment csc](https://reader036.fdocuments.in/reader036/viewer/2022082822/5695cffd1a28ab9b02906ea8/html5/thumbnails/2.jpg)
![Page 3: Assignment csc](https://reader036.fdocuments.in/reader036/viewer/2022082822/5695cffd1a28ab9b02906ea8/html5/thumbnails/3.jpg)
QUESTION 6-TUTORIAL 2
![Page 4: Assignment csc](https://reader036.fdocuments.in/reader036/viewer/2022082822/5695cffd1a28ab9b02906ea8/html5/thumbnails/4.jpg)
TUTORIAL 2- QUESTION 12
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int x,y,Total;
cout<<"Please enter no of adult : ";
cin>>x;
cout<<"Please enter no of teenager : ";
cin>>y;
Total=(x*23)+(y*14);
cout<<"The total payment is RM : "<<Total<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
![Page 5: Assignment csc](https://reader036.fdocuments.in/reader036/viewer/2022082822/5695cffd1a28ab9b02906ea8/html5/thumbnails/5.jpg)