Write a program to enter radius of circle and print perimeter if its radius is less than 5 otherwise print area of circle

Perimeter of circle (C) = 2*pi*r
Area of circle (A) = pi*r*r

#include<stdio.h>
void main()
{
  int r;
  float pi=3.14, c, a;
  printf("Enter radius of circle");
  scanf("%d", &r);
  if(r>5)
   {
      c = 2*pi*r;
      printf("Circumference of circle = %f", c);
    }
 else
     {
      a = pi*r*r ;
      printf("Area of circle = %f", a);
    }
  }
  

Post a Comment

0 Comments