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