0
Challenge predict the output
#include <iostream> using namespace std; int main() { int n=6; int s=n; for(int i=1;i<=n;i++,s--) { for(int k=1;k<=s;k++) cout<<k; int y=s; while(y<n){ cout<<"A"; y++;} if(i<3) for(int h=n-1;h>=1;h--){ cout<<h; } if(i>=3){ int h2=n-1; for(int u=2;u<i;u++){ cout<<"A"; h2--;} for(int x=h2;h2>=1;h2--){ cout<<h2; }} cout<<endl; } }
1 Réponse
+ 1
12345654321
12345A54321
1234AAA4321
123AAAAA321
12AAAAAAA21
1AAAAAAAAA1