how to find the largest & smallest number???

closed account (o2TCpfjN)
i enter some number in the program(non-negative numbers)
how to find the largest & smallest number???
use the '>' and '<' operators
This Should be work...

#include <stdio.h>
int main(){
int num1,num2;
printf("enter the first number\n");
scanf("%d",&num1);
printf("enter the second number\n");
scanf("%d",&num2);

if(num1>num2)
printf("First number %d bigger\n",num1);
else if(num2>num1)
printf("Second number %d bigger\n",num2);
else
printf("the number are equal\n");
return 0;
}
You might wanna be a bit more specific
Topic archived. No new replies allowed.