In this tutorial learn how you can write a c program to find the area of a circle get the radius from the user and use pi as a constant variable. First, we will ask the user for the radius and then add get area of circle.
C programming is a powerful general-purpose programming language. It can be used to develop software like operating systems, databases, compilers, etc.
Here is the code to find the area of a circle get the radius from the user and use pi as a constant variable.
#include <stdio.h> //WAP to find the area of circle. Get radius from the user. Use PI as a constant variable.
int main(){
const double PI=3.14; //Use PI as a constant variable.
float radius, area;
printf("Please enter the radius:");
scanf("%f",&radius); //Get radius from user
area= PI*(radius*radius);
printf("The area of circle is:%f",area);
return 0;
}
This is how you can find the area of a circle, get the radius from the user and use pi as a constant variable in c programming. Comment below if you like our tutorial.
I am live on these platform.Thus,you can contact me on the contact below.
0 Comments