In this example, we will calculate area of circle based on user input.
#include<stdio.h>
int main() {
float radius, area;
printf("\nEnter the radius of Circle : ");
scanf("%f", &radius);
area = 3.14 * radius * radius;
printf("\nArea of Circle : %.2f", area);
return (0);
}
Output :
Enter the radius of Circle : 10
Area of Circle : 314.00
Ask anything about this examples