Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main() {
- int num1, num2, opcao, soma;
- printf("Digite a opcao desejada. \n 1-Multiplicar \n 2-Somar \n 3-Subtrair \n 4-Dividir \n 5-Sair");
- scanf("%d", &opcao);
- while(opcao !=5 ) {
- printf("Digite o primeiro numero");
- scanf("%d", &num1);
- printf("Digite o segundo numero");
- scanf("%d", &num2);
- switch(opcao) {
- case 1:
- soma = num1 * num2;
- printf("%d", soma);
- break;
- case 2:
- soma = num1 + num2;
- printf("%d", soma);
- break;
- case 3:
- soma = num1 - num2;
- printf("%d", soma);
- break;
- case 4:
- soma = num1 / num2;
- printf("%d", soma);
- break;
- default :
- printf("Operação invalida");
- }
- printf("Digite a opcao desejada. \n 1-Multiplicar \n 2-Somar \n 3-Subtrair \n 4-Dividir \n 5-Sair");
- scanf("%d", &opcao);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement