Infolinks - Earn Easy Money

Saturday, April 4, 2015

C++ program to find out different dimensions of rectangle or circle

#include <iostream>
using namespace std;
int main ()
{
float length, breadth, radius;
float aofr, perimeter, aofc, circumference;

cout<<" Program to calculate area and perimeter of a rectangle & \n";
cout<<" Area and Circumference of a circle \n\n";

cout<<" Enter the length of Rectangle \n";
cin>> length;

cout<<" Enter the breadth of that Rectangle \n";
cin>> breadth;

cout<<" Now enter the radius of circle \n";
cin>> radius;

aofr=length*breadth;
cout<<" Area of Rectangle is \n";
cout<< aofr;

perimeter=(2*length)+(2*breadth);
cout<<" \n Perimeter of rectangle is \n";
cout<< perimeter;

aofc= 3.14*(radius*radius);
cout<<" \n Area of Circle is \n";
cout<< aofc;

circumference=2*3.14*radius;
cout<<" \n Circumference of Circle is \n";
cout<< circumference;
return 0;

}

No comments:

Post a Comment

Must drop your comments about post.