1
I have a code that I wrote, it takes two numbers and sums, subtracts, multiplies and divides. However, when incrementing the questions in the code and then running it reads only the number of the first question.
Where am I wrong? Since apparently the code has no error.
error while compiling:
follows the code:
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main()
{
setlocale(LC_ALL, "Portuguese");
printf("===============\n");
printf("CALCULADORA 1.0");
printf("\n===============\n");
int num1, num2, soma, subtracao, multi, div;
soma = num1 + num2;
subtracao = num1-num2;
multi = num1 * num2;
div = num1 / num2;
printf("Digite Dois Números a serem calculados:\n");
printf("Primeiro Número:\n");
scanf("Primeiro Número:%i\n",&num1);
printf("Segundo Número:\n");
scanf("Segundo Número:%i\n",&num2);
printf("A soma é :%i\n",soma);
printf("A subtração é : %i \n",subtracao);
printf("O produto é:%i \n",multi);
printf("A divisão é :%i \n",div);
}
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site
– Maniero