Upload
atie-iekah
View
220
Download
0
Embed Size (px)
DESCRIPTION
csc
Citation preview
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
QUESTION 6-TUTORIAL 2
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;
}