//FINDING THE AREA AND PERIMETER OF A CIRCLE USING SWITCH STATEMENT IN C
#include<stdio.h>
#include<conio.h>
int main(){
float r;
int choice;
float result;
printf("Press 1 to find the area of circel :\n");
printf("Press 2 to find the perimeter of circle :\n");
printf("\n Enter Your Choice :");
scanf("%d", &choice);
if(choice>2)
printf("bro that's the wrong number you will get an error anyway \n");
printf("Enter the Radius of circle : ");
scanf("%f", &r);
switch(choice)
{
case 1:
result = (3.14*r*r);
printf("Area of circle is :%f ",result);
break;
case 2:
result = (2*3.14*r);
printf("Perimeter of circle is :%f ",result);
break;
default :
printf("ERROR 404");
}
return 0;
}
Comments
Post a Comment