Slip 2 - A) Write a C program to accept radius of a circle and display the area and circumference of a circle.

Solution:


#include<stdio.h>

int main() {

   int rad;
   float PI = 3.14, area, ci;

   printf("\nEnter radius of circle: ");
   scanf("%d", &rad);

   area = PI * rad * rad;
   printf("\nArea of circle : %f ", area);

   ci = 2 * PI * rad;
   printf("\nCircumference : %f ", ci);

   return (0);
}

Post a Comment

0 Comments