If you have 5 numbers the main cause shold be a out of bounds error. Use the below.
for (a=0;a<4;a++)
{
for (b=a+1;b<4;b++)
{
Edit:
No. Sorry. My mistake. Your code is correct. I got carried away by the <= sign. As Salem says, the error should be elsewhere.
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
Well some context for the code would help.
Like how did you declare the num array?
How did you get data into it?
How did you print it out?
It looks about right "as is", so I can only assume the mistake is somewhere else.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953