Refer to my other post
Code:
for(i=1;i<=5;i++)  {
  for(j=1;j<=i;j++)
    printf("%i",i);
  printf("\n");
}
Becomes
Code:
i=1;
while ( i<=5 ) {
  for(j=1;j<=i;j++)
    printf("%i",i);
  printf("\n");
  i++;
}
Now apply the same transformation to the inner loop, and you're done.