S
SKY[net]
Hi, I need some help. I'm a beginner programmer.
I need to do a comparison between 3 numbers and tell the user if it's
ascendinf, descending, equal or in no ordre. and ask if the user wants
to compare 3 more numbers. Here's what i've done.
that code only asks me the 3 numbers. It closes right after that. I
don't know if he does the comparison. Do you think I need a while to
ask the question if the user wants to compare 3 other numbers?
#include <stdio.h>
int num1, num2, num3;
void main ()
{
printf ("\n What are the 3 numbers to compare?");
scanf ("%s", &num1, &num2, &num3);
if (num1 < num2)
if (num2 < num3)
printf ("\n ascending");
if (num1 < num2)
if (num2 > num3)
printf ("\n no order");
if (num1 > num2)
if (num2 > num3)
printf ("\n descending");
if (num1 > num2)
if (num2 < num3)
printf ("\n no order");
if (num1 == num2)
if (num2 == num3) ¸
printf ("\n equals");
if (num1 == num2)
if (num2 != num3)
printf ("\n no order");
}
I need to do a comparison between 3 numbers and tell the user if it's
ascendinf, descending, equal or in no ordre. and ask if the user wants
to compare 3 more numbers. Here's what i've done.
that code only asks me the 3 numbers. It closes right after that. I
don't know if he does the comparison. Do you think I need a while to
ask the question if the user wants to compare 3 other numbers?
#include <stdio.h>
int num1, num2, num3;
void main ()
{
printf ("\n What are the 3 numbers to compare?");
scanf ("%s", &num1, &num2, &num3);
if (num1 < num2)
if (num2 < num3)
printf ("\n ascending");
if (num1 < num2)
if (num2 > num3)
printf ("\n no order");
if (num1 > num2)
if (num2 > num3)
printf ("\n descending");
if (num1 > num2)
if (num2 < num3)
printf ("\n no order");
if (num1 == num2)
if (num2 == num3) ¸
printf ("\n equals");
if (num1 == num2)
if (num2 != num3)
printf ("\n no order");
}