hey, sorry to trouble u guys.
ok, i've got a prob...the qn goes like this:
the user is supposed to input 10 integers (can be positive or negative) and write a prog to select the 2 largest integers and print these 2 largest integers...
ok, my prog goes like this but it does not work...WHY?i don't understand...oh and i'm using a standard ANSI compiler.
#include <stdio.h>
main ()
{
int num1, num2,.............num10;
int ans1, ans2;
printf ("10 intergers pls:");
scanf ("%d%d%d%d%d%d%d%d%d%d", &num1, &num2,...&num10);
if (num1 >num2){
ans1 = num1;
ans2 = num2;
}
if (num1 <= num2){
ans2 = num1;
ans1 = num2;
}
if (ans1 < num)
ans1 = num3;
if (ans2 < num3 && ans1 >= num3)
ans2 = num3;
.
.
.
.
.
.
/*same selection process for num4 to num10*/
printf("the ans is %d and %d", ans1, ans2);
return ;
}
is the selection process wrong?how shld it be corrected?