-3
I have a question in the following exercise:
Create a program that takes two whole numbers and shows the result of division of numbers and their rest. the program should ask if the user intends to repeat the operation or terminate the program.
I do not know how to do so that at the end of the program if I type 1, it closes, if type 2 again, follows below my program:
int main()
{
int var1, var2, Q, R;
printf("Digite o dividendo: ");
scanf("%d", &var1);
printf("Digite o divisor: ");
scanf("%d", &var2);
Q = var1 / var2;
R = var1 % var2;
printf("Resultado: %d\n", Q);
printf("Resto: %d\n", R);
int decisao;
printf("\nDeseja encerrar o programa? \n1 para sim e 2 para nao.");
scanf("%d", &decisao);
}
You’ve studied the command
while
? https://answall.com/questions/241665/la%C3%A7o-de-repeti%C3%A7%C3%A3o-em-c/241694– Ricardo Pontual