Is there any difference between these cout statements?

I am hemanth. I am solving a uva problem (Id 100).
Below the program for that one
It is giving right output.
but when i am sublitting the code it is displaying Wrong Answer.
then i modified one cout statement, then it is accepted.
Is there any difference between these two approaches.


--------------------------------------
wrong answer
--------------------------------------
#include<stdio.h>
#include<iostream>
using namespace std;



int main()
{
int n,n1,v,s,s1;
int count;
int temp1;
int max;
int flag=0;
while( scanf("%d%d",&n,&n1)!= EOF)
{

if(n>n1)
{
temp1=n;
n=n1;
n1=temp1;
flag=1;
}
max = 1;
for(s1 = n; s1<=n1;s1++)
{
s= s1;
count = 1;


for(;s!=1;)
{
if (s%2 == 1)
s = ((3*s) + 1 );
else
s = (s/2);
count++;
}

if(count > max)
max = count;
}



cout << n << " " << n1 << " " << max << endl; //(i am display all together)


}
return 0;
}

------------------------------------------------------------------
modified one - It is being Accepted
------------------------------------------------------------------
#include<stdio.h>
#include<iostream>
using namespace std;



int main()
{
int n,n1,v,s,s1;
int count;
int temp1;
int max;
int flag=0;
while( scanf("%d%d",&n,&n1)!= EOF)
{
cout << n << " " << n1 << " " ; //(i am display first two variables here )together)
if(n>n1)
{
temp1=n;
n=n1;
n1=temp1;
flag=1;
}
max = 1;
for(s1 = n; s1<=n1;s1++)
{
s= s1;
count = 1;


for(;s!=1;)
{
if (s%2 == 1)
s = ((3*s) + 1 );
else
s = (s/2);
count++;
}

if(count > max)
max = count;
}


cout << max << endl;( and printing the last one here)



}
return 0;
}
----------------------------------------------

Is there any difference in placement of that cout statement?
Bcoz 1 is accepted and another one is wrong answer. (on online Judge)
--------------------------------------------------
hemanth.avs
Dont go through the logic, just have a look at placement of cout statements,

give the possible reason.
Topic archived. No new replies allowed.