rabbinur

nested loop

Aug 15th, 2012
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include<iostream.h>
  2.  
  3. #include<conio.h>
  4.  
  5. void main()
  6.  
  7. {
  8.  
  9. int i,j,k;
  10.  
  11. clrscr();
  12.  
  13. for(k=1;k<=32;k++)
  14.  
  15. {
  16.  
  17. for(i=k;i<=30;i++)
  18.  
  19. cout<<"*";
  20.  
  21. for(j=2;j<=k;j++)
  22.  
  23. cout<<" ";
  24.  
  25. for(j=2;j<=k;j++)
  26.  
  27. cout<<" ";
  28.  
  29. for(i=k;i<=30;i++)
  30.  
  31. cout<<"*";
  32.  
  33. cout<<endl;
  34.  
  35. }
  36.  
  37. getch();
  38. }
Advertisement
Add Comment
Please, Sign In to add comment