0
When I put to show the numbers that were exchanged the program just shows nothing, I do not understand why.
Read two numbers by storing them in the variables num1 and num2. Check if the value of num1 is greater than the value of num2, and if so, exchange the contents of the variables
#include <stdio.h>
int main(){
/*Ler dois números, armazenando-os nas variáveis num1 e num2. Verificar se o valor de
num1 é maior que o valor de num2 e, em caso positivo, trocar os conteúdos das variáveis*/
int num1, num2, x;
printf("Digite o valor do primeiro numero\n");
scanf("%d", &num1);
printf("Digite o valor do segundo numero\n");
scanf("%d", &num2);
x=num1;
if (num1<num2){
num1=num2;
num2=x;
printf("O valor do primeiro numero é:\n", num2);
printf("O valor do segundo numero é:\n", x);
}
return 0;
}
Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site (when you have enough score).
– Maniero