+ 1

patter logic can any one give me the code?? below pattern in c or java or c++ using for loop

abcdefg abc efg ab fg a g

4th Aug 2017, 4:54 AM
Bhavin Kanzariya
Bhavin Kanzariya - avatar
3 Antworten
+ 2
c++ : int n=7; for(int i=0;i<n;++i){ for(int j=0;j<n;++j) if(j>n/2-i && j<n/2+i) cout<<" "; else cout<<(char)('a'+j); cout<<endl; }
4th Aug 2017, 9:22 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
thanks u .....
4th Aug 2017, 10:51 AM
Bhavin Kanzariya
Bhavin Kanzariya - avatar
+ 1
you are welcome :)
4th Aug 2017, 11:15 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar