--- In [email protected], muhammad shoaib <[EMAIL PROTECTED]> wrote:
>
> this one is showing output like this but agian its not right.
>    
>   xxxxxxxxxx
>   xxxxxxxxxx
>   xxxxxxxxxx
>   xxxxxxxxxx
>    
>   int main ()
> {
>    int i=10, j=10;
>    while (i>=1)
>      {
>     j=10;
>   while (j>=1)
>   {
>    cout<<"x";
>       j--;
>   }
>   
> cout<<endl;
> i--;
>  }
>   return 0;
> }
<snip>

That's easy: the loop for "j" ends when j reaches the value 1.
However, what you seem to want is that the loop ends as soon as "j"
hits "i", meaning the "while" statement should read:
  while (j >= i)
instead of:
  while (j >= 1)

Regards,
Nico

Reply via email to