Hi everyone:
I have to list three inout numbers in ascending order and here's my code so far:
Not perfect yet but my question is this:Code:
*/
Variables
num1 The first number input by the user
num2 The second number input by the user
num3 The third number input by the user
*/
#include <stdio.h>
int main()
{
float num1;
float num2;
float num3;
float largest;
float middle;
float smallest;
printf("Enter first number\n" );
scanf( "%f" , &num1 );
printf("Enter second number\n" );
scanf("%f" , &num2);
printf("Enter the third number\n" );
scanf("%f", &num3 );
if (num1 > num2 )
largest = num1;
printf(The largest number is: %.2f\n, num1);
return 0;
}
Instead of writing a HUGE if statements for all three numbers how can I write something like this:
If num1 > num2 and >num3
then the largest number is num1
Any idea how this is done?
Thank you very much.
-Extro