IDNStudy.com, ang iyong mapagkakatiwalaang mapagkukunan para sa maaasahang mga sagot. Magtanong at makatanggap ng maaasahang sagot mula sa aming dedikadong komunidad ng mga eksperto.
Sagot :
i like scripting you can use this source code
/* Source code to create a simple calculator for addition, subtraction, multiplication and division using switch...case statement in C programming. */ # include <stdio.h> int main() { char operator; float num1,num2; printf("Enter operator either + or - or * or divide : "); scanf("%c",&operator); printf("Enter two operands: "); scanf("%f%f",&num1,&num2); switch(operator) { case '+': printf("num1+num2=%.2f",num1+num2); break; case '-': printf("num1-num2=%.2f",num1-num2); break; case '*': printf("num1*num2=%.2f",num1*num2); break; case '/': printf("num2/num1 = %.2f",num1/num2); break; default: /* If operator is other than +, -, * or /, error message is shown */ printf("Error! operator is not correct"); break; } return 0; }
Enter operator either + or - or * or divide: / Enter two operands: 13.456 4.56 num2/num1 = 2.95
/* Source code to create a simple calculator for addition, subtraction, multiplication and division using switch...case statement in C programming. */ # include <stdio.h> int main() { char operator; float num1,num2; printf("Enter operator either + or - or * or divide : "); scanf("%c",&operator); printf("Enter two operands: "); scanf("%f%f",&num1,&num2); switch(operator) { case '+': printf("num1+num2=%.2f",num1+num2); break; case '-': printf("num1-num2=%.2f",num1-num2); break; case '*': printf("num1*num2=%.2f",num1*num2); break; case '/': printf("num2/num1 = %.2f",num1/num2); break; default: /* If operator is other than +, -, * or /, error message is shown */ printf("Error! operator is not correct"); break; } return 0; }
Enter operator either + or - or * or divide: / Enter two operands: 13.456 4.56 num2/num1 = 2.95
Pinahahalagahan namin ang bawat tanong at sagot na iyong ibinabahagi. Huwag kalimutang bumalik at magtanong ng mga bagong bagay. Ang iyong kaalaman ay mahalaga sa ating komunidad. Para sa mabilis at maasahang mga sagot, bisitahin ang IDNStudy.com. Nandito kami upang tumulong sa iyo.