|
Response Details:
please rate - thanks
#include <stdio.h>
#include<conio.h>
int main()
{double d,m,v,v2,p1,p2;
int num;
printf("Do you want to find density or pressure?\n");
printf("1 to find density\n2 find pressure\n");
scanf("%d",&num);
switch(num)
{case 1:printf("Enter the value for m: ");
scanf("%lf",&m);
printf("Enter the value for v: ");
scanf("%lf",&v);
printf("The density is %lf\n", m/v);
break;
case 2:printf("Enter the value for p1: ");
scanf("%lf",&p1);
printf("Enter the value for v1: ");
scanf("%lf",&v);
printf("Enter the value for v2: ");
scanf("%lf",&v2);
printf("The pressure is %lf\n", (p1*v)/v2);
break;
default: printf("Invalid Input-program aborted\n");
}
getch();
return 0;
}
|