Write a C Program to Find the Area of Circle | Get Radius from the user and Use PI as a Constant Variable

January 11, 2023 0 Comments

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.

Write a Program to Find the Area of the Circle Get the Radius from the user and Use PI as a Constant Variable

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;
}

Test Live At Jdoodle

Conclusion

This is how you can divide two numbers and print them on the screen in java programming. Comment below if you like our tutorial.

Leave a comment

Gallery