print pattern 12345 , 23451, 34512 ,45123 ,51234 in c++ and python
12345 23451 34512 45123 51234 How to print this pattern in c++? CODE: #include<iostream> #include<conio.h> using namespace std; int main() { int i=1,k,j; while(i<=5) { j=i; while(j<=5) { cout<<j; j++; } k=1; while(k<i) { cout<<k; k++; } cout<<endl; i++; } } OUTPUT: How to print this pattern in python? CODE: i=1 while(i<=5): j=i while(j<=5): print(j,sep="",end="") j=j+1 k=1 while(k<i): print(k,sep="",end="") k=k+1 print() i+=1 O...
Comments
Post a Comment