0% found this document useful (0 votes)
4 views

Code2pdf 66f86dea59c3c

Code of a program university assignment

Uploaded by

alayanmati8
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Code2pdf 66f86dea59c3c

Code of a program university assignment

Uploaded by

alayanmati8
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

// Name: Mati ur Rehman

// Roll Number: 24021519-092


// Date: September 29, 2024

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
int choice;
float area,length,width,sides,rad;

cout << "Choose the shape you want to calculate the area for:\n";
cout << "1 for Circle\n";
cout << "2 for Rectangle\n";
cout << "3 for Cube\n";
cout << "Enter your choice here: ";
cin >> choice;

if (choice==1)
{
cout << "enter radius of the circle: " ;
cin >> rad ;
area = M_PI*rad*rad;
cout << "The area of the circle is: " << area << endl;
}

else if (choice==2)
{
cout<< "enter the length of rectangle:";
cin >> length;
cout << "Enter the width of rectangle:";
cin >> width;
area = length * width;
cout << "the area of rectangle is:" << area << endl;

}
else if (choice==3)
{
cout<< "enter the Sides of Cube:";
cin >> sides;
area = sides*sides*6;
cout << "The area of the cube is: " <<area;

}
else {
cout << "Invalid choice. Please enter a number between 1 to 3." << endl;
}

return 0;
}

You might also like