Sample Input:
3
Sample Output:
3 44 555 6666 6666 555 44 3
Sample Input:
4
Sample Output:
4
55
666
7777
7777
666
55
4
Sample Input:
5
Sample Output:
5
66
777
8888
8888
777
66
5
SOLUTION:
#include<iostream> using namespace std; int main(){ int n, i, j, temp; cin>>n; temp = n; for(i = 1; i < 5; i++){ for(j = 0; j < i; j++){ cout<<temp; } temp++; cout<<"\n"; } temp--; for(i = 4; i > 0; i--){ for(j = i; j > 0; j--){ cout<<temp; } temp--; cout<<"\n"; } return 0; }
This code doesn't clear test case for 3 44 555 6666 6666 555 44 3
ReplyDeleteIt is working my friend.
Delete