Computer Science, asked by gaurisingh8c, 5 months ago

CREATE A PROGRAM TO CALCULATE A AREA OF CIRCLE IF THE USER ENTER 1 AND PRINT THE PERIMETER OF A CIRCLE IF THE UER ENTER 2.

Answers

Answered by pjgaikar06
1

Answer:

#include <stdio.h>

int main()

{

  int circle_radius;

  float PI_VALUE=3.14, circle_area, circle_circumf;

  //Ask user to enter the radius of circle

  printf("\nEnter radius of circle: ");

  //Storing the user input into variable circle_radius

  scanf("%d",&circle_radius);

  //Calculate and display Area

  circle_area = PI_VALUE * circle_radius * circle_radius;

  printf("\nArea of circle is: %f",circle_area);

  //Caluclate and display Circumference

  circle_circumf = 2 * PI_VALUE * circle_radius;

  printf("\nCircumference of circle is: %f",circle_circumf);

  return(0);

}

Similar questions