Advertisement
meytasfrn

tugas2

Nov 26th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. // Tugas Praktikum Komdas C - 2
  2. #include <iostream>
  3. #include <conio.h>
  4.  
  5. using namespace std;
  6.  
  7. int main (){
  8.  
  9. int i,j;
  10. {
  11. for (i=1;i<=7;i++)
  12. {
  13. for (j=i;j<=21;j++)
  14. {
  15. if (i==1)
  16. if((j==1)||(j==5)||((j>=7)&&(j<=10))||((j>=12)&&(j<=16))||((j>=18)&&(j<=19)))
  17. cout<<"*";
  18. else cout<<" ";
  19.  
  20. else if (i==2)
  21. if(((j>=1)&&(j<=2))||((j>=4)&&(j<=5))||(j==7)||(j==14)||((j>=18)&&(j<=19)))
  22. cout<<"*";
  23. else cout<<" ";
  24.  
  25. else if (i==3)
  26. if((j==1)||(j==3)||(j==5)||((j>=7)&&(j<=9))||(j==14)||((j>=18)&&(j<=19)))
  27. cout<<"*";
  28. else cout<<" ";
  29.  
  30. else if (i==4)
  31. if((j==1)||(j==3)||(j==5)||(j==7)||(j==14))
  32. cout<<"*";
  33. else cout<<" ";
  34.  
  35. else if (i==5)
  36. if((j==1)||(j==5)||((j>=7)&&(j<=10))||(j==14)||((j>=18)&&(j<=19)))
  37. cout<<"*";
  38. else cout<<" ";
  39. }
  40. cout<<endl;
  41. }
  42. getch();
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement