Solution:
#include<stdio.h>
void main()
{
int n1,n2,t,choice;
float arithmetic_mean,harmonic_mean;
printf("\n Enter the radius of circle:- ");
scanf("%d%d",&n1,&n2);
printf("\n Please make a choice from the following :");
printf("\n \n Options:\t \t \t \t");
printf("Actions:");
printf("\n \n 1. SWap :");
printf("\n \n 2. MEAN ");
scanf("%d",&choice);
switch(choice)
{
case 1:
t=n1;
n1=n2;
n2=t;
printf("\n swap=%d %d \n \n",n1,n2);
break;
case 2:
arithmetic_mean = (n1+n2) /2;
harmonic_mean = (n1*n2) / (n1+n2);
printf("arithmetic mean = %f and harmonic mean = %f",arithmetic_mean,harmonic_mean);
break;
default:
printf("\n You haven made invalid choice \n \n");
}
} // End of the code
0 Comments