heryvandoro

Untitled

Dec 2nd, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. for(int i=1; i<=6; i++){
  6. cout << 1;
  7. //genap
  8. if(i%2==0){
  9. for(int j=1; j<=i-1; j++){
  10. cout << j*2;
  11. }
  12. }
  13. //ganjil
  14. else{
  15. for(int j=2; j<=i; j++){
  16. cout << j*2-1;
  17. }
  18. }
  19.  
  20. cout << endl;
  21. }
  22. getchar();
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment