1
I worked out a very simple algorithm, but I’m not able to do the same.
Follows:
#include <stdio.h>
int num1, num2, soma, multiplicacao;
int main(){
printf("informe primeiro número: ");
scanf("%d", &num1);
printf("informe segundo número: ");
scanf("%d", &num2);
soma = num1 + num2;
multiplicacao = soma * num1;
printf("o resultado é %d", multiplicacao);
}
The problem I’m facing is that the console does not open so that I can add the values, when open does not bring me the result, only appears the CMD to add the variables num1
and num2
and then closes.
And bring me the information "Info: Nothing to build for C programs"
I’m using Eclipse as an IDE.
uses the
system("pause")
at the end of the function (needs the library#include <stdlib.h>
)– Walter Felipe
an alternative function is to use the
getChar();
, Then he doesn’t even need a new library– Walter Felipe