Pls help me solve this guys....
the code is as below:
Code:
#include <stdio.h>
#include <math.h>
//#define A 90
//#define B 180
//#define C 360
#define PI 3.1416
void main(void)
{
char choice;
float voltage, current, totalPower, angle;
printf("MENU");
printf("\n=====");
printf("\nFinding the total power for different angles:");
printf("\nA. 90");
printf("\nB. 180");
printf("\nC. 360");
printf("\nD. Others");
printf("\nE. Quit");
printf("\n\nYour choice: ");
scanf("%c", &choice);
switch(choice)
{
case 'A' :angle = 90;
printf("Enter the voltage(V):");
scanf("%f", &voltage);
printf("Enter the current(A):");
scanf("%f", ¤t);
totalPower = voltage * current * cos((angle * PI) / 180);
printf("Total power = %.2fw\n", totalPower);
break;
case 'B' :angle = 180;
printf("Enter the voltage(V):");
scanf("%f", &voltage);
printf("Enter the current(A):");
scanf("%f", ¤t);
totalPower = voltage * current * cos ((angle * PI) / 180);
printf("Total power = %.2fw\n", totalPower);
break;
case 'C' :angle = 360;
printf("Enter the voltage(V):");
scanf("%f", &voltage);
printf("Enter the current(A):");
scanf("%f", ¤t);
totalPower = voltage * current * cos ((angle * PI) / 180);
printf("Total power = %.2fw\n", totalPower);
case 'D' :printf("Enter the angle:");
scanf("%f", &angle);
printf("Enter the voltage(V):");
scanf("%f", &voltage);
printf("Enter the current:");
scanf("%f", ¤t);
totalPower = voltage * current * cos ((angle * PI) / 180);
printf("Total power = %.2fw\n", totalPower);
break;
case 'E' :printf("Bye-Bye!\n");
break;
default :printf("Invalid Option!!\n"); //none of the above
break;
} //end switch
} //end main
Code tags added by Kermi3 - Disabled smiles too