WAP to check whether the number entered is divisible by 5. If yes, then find the area of circle otherwise find the circumference of circle
//WAP to check whether the number is divisible by 5. If yes, then find the area of circle otherwise find the circumference of circle//
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
float ar, r, cir;
printf("Enter the number\n");
scanf("%d", &n);
printf("Enter the radius\n");
scanf("%f", &r);
if (n%5==0)
{
printf("Number is divisible by 5\n");
ar=3.14*r*r;
printf("Area of circle is: %f", ar);
}
else
{
printf("Number is not divisible by 5\n");
cir=2*3.14*r;
printf("Circumference is: %f", cir);
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
float ar, r, cir;
printf("Enter the number\n");
scanf("%d", &n);
printf("Enter the radius\n");
scanf("%f", &r);
if (n%5==0)
{
printf("Number is divisible by 5\n");
ar=3.14*r*r;
printf("Area of circle is: %f", ar);
}
else
{
printf("Number is not divisible by 5\n");
cir=2*3.14*r;
printf("Circumference is: %f", cir);
}
getch();
}
Comments
Post a Comment