0
#include<stdio.h>
void main()
{
int n1,n2,n3,maior,menor;
printf("Primeiro numero: ");
scanf("%d", n1);
printf("Segundo numero: ");
scanf("%d", n2);
printf("Terceiro numero: ");
scanf("%d", n3);
if (n1>n2&&n1>n3)
{
maior=n1;
if (n2>n3)
menor=n3;
else
menor=n2;
}
else if (n2>n1&&n2>n3)
{
maior=n2;
if (n1>n3)
menor=n3;
else
menor=n1;
}
else
{
maior=n3;
if (n1>n2)
menor=n2;
else
menor=n1;
}
printf("Menor numero: %d\nMaior numero: %d",menor,maior);
}
After asking the first number and I give the answer, the program crashes. Does anyone know why that is? I’m using Codeblocks because it’s recommended by the university.
Hi. What input are you putting into the system?
– Lucas Augusto Coelho Lopes
@alwaysNever You forgot the commercial E operator (&) before the variable names in each scanf. Recommended reading -> https://answall.com/questions/125793/qual-significado-operador-e-comercial-na-linguagem-c
– user137493
MY GOD was that, obg. If I knew how to give a little bit I would give. I am compiling in C for another comment
– alwaysNever