If the user types a number other than 1 and 2, he asks to terminate the program? \ n [1] for yes and [2] for no
#include <stdio.h>
#include <stdlib.h>
int main()
{
int N1, N2, Q, R, OP;
{
do
{
printf("DIVIDINDO DOIS NUMEROS: \n\n");
printf("Digite o dividendo: ");
scanf("%d", &N1);
printf("Digite o divisor: ");
scanf("%d", &N2);
Q = N1 / N2;
R = N1 % N2;
printf("\nResultado: %d\n", Q);
printf("Resto: %d\n", R);
printf("\n\nDeseja encerrar o programa?\n[1] para sim e [2] para nao.\n");
printf("\nOpcao: ");
scanf("%d", &OP);
printf("\n \n");
}
while (OP == 2);
if (OP >= 1)
{
exit(0);
}
system("PAUSE>>NULL");
return 0;
}
}