Computer Science, asked by amaltp099, 1 month ago

Write a C program to accept radius of a circle and display the area and circumference
of a circle.​

Answers

Answered by anindyaadhikari13
2

Solution:

The given cσde is written in C -

#include <stdio.h>

int main(){

   int radius;

   float area,perimeter,pi=3.14;

   printf("Enter the radius: ");

   scanf("%d",&radius);

   area=pi*radius*radius;

   perimeter=2*pi*radius;

   printf("Area of the circle is: %f\n",area);

   printf("Perimeter of the circle is: %f",perimeter);

   return 0;

}

Logic:

  • Take the number as input.
  • Calculate perimeter and area and store them in separate variable.
  • Display the values of the variables.

See the attachment for output.

Attachments:
Similar questions