C++ program to calculate the area and circumference of a circle
codeaft.cpp
#include<iostream>usingnamespacestd;#define PI 3.141592654
intmain(){floatR;cout<<"———————————————————————————————————————————";cout<<"\nProgram to calculate the area and circumference of a circle";cout<<"\n———————————————————————————————————————————";cout<<"\nEnter the radius of a circle ";cin>>R;cout<<"\nThe area of a circle is "<<PI*R*R;cout<<"\nThe circumference of a circle is "<<2*PI*R;cout<<"\n———————————————————————————————————————————\n";return0;}
Output
codeaft@codeaft:~$ g++ codeaft.cpp codeaft@codeaft:~$ ./a.out
———————————————————————————————————————————
Program to calculate the area and circumference of a circle
———————————————————————————————————————————
Enter the radius of a circle 10
The area of a circle is 314.159
The circumference of a circle is 62.8319
———————————————————————————————————————————
codeaft@codeaft:~$
Dear User, Thank you for visitng Codeaft. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.