Here , In this program we will calculate the area of circle simply by calculating it using 
  its formulae  (3.14 *r*r ) and  printing its value by taking radius as input from user. 
  here we have used two data types integer and float ( decimal numbers) as we will be taking 
  radius as integer and output will be in decimal form that's why we have used float data type,
  
  Program

  #include<stdio.h>

  int main()

 {

  int radius;

  float area_of_circle;

  printf("Enter the radius of circle= ");

  scanf("%d",&radius);

  area_of_circle = 3.14*radius*radius;

  printf("Area of circle is = %f",area_of_circle);

  return 0;

 }

Output:


Here, we have entered value of radius as 5 , you can enter your desired value and get output accordingly by using this program.

                       << Back



Post a Comment

Previous Post Next Post