Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- for(int i=1; i<=6; i++){
- cout << 1;
- //genap
- if(i%2==0){
- for(int j=1; j<=i-1; j++){
- cout << j*2;
- }
- }
- //ganjil
- else{
- for(int j=2; j<=i; j++){
- cout << j*2-1;
- }
- }
- cout << endl;
- }
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment