write programs write the area of a circle using #define
Answers
Answer:
// C++ program to find area
// of circle
#include <iostream>
const double pi = 3.14159265358979323846;
using namespace std;
// function to calculate the area of circle
float findArea(float r)
{
return (pi * r * r);
}
// driver code
int main()
{
float r, Area;
r = 5;
// function calling
Area = findArea(r);
// displaying the area
cout << "Area of Circle is :" << Area;
return
Output:
Area is 78.550000
Answer:
#include < stdio.h >
#include < conio.h > #define PI 3.141
int main()
{
float radius, area;
printf("Enter radius of circle\n");
scanf("%f", & radius);
area = PI * radius * radius;
printf("Area of circle : %0.4f\n", area);
getch();
return 0;
}
Explanation:
Through programming, finding an area of a circle is clearly understood.