Write a C++ program that inputs the radius of a circle and displays the circumference by using formula 2πR. Store the value of π in a constant by using DEFINE directive.

 


#include<iostream>

#define PI 3.141

using namespace std;

int main()

      float r, area;

cout<<"Enter radius ";

cin>>r;

area = 2.0*PI*r;

cout<<"Area = "<<area;

}

OUPUT 

Enter the radius 4

Area = 25.128



No comments:

Post a Comment