Popular posts from this blog
printing triangle pattern using for loops in c++
C ode to print triangle in c++ #include<iostream> using namespace std; int main() { //Double slash is used to give comment in c++ language. int i,j,k; for(i=0;i<7;i=i+1) { for(k=20-i;k>=0;k--) //loop for spacing {cout<<" ";} for(j=0;j<=i;j++) {cout<<"* ";} //don't forget to give one space after * cout<<endl; //endl move the cursor to next line } return(0); } OUTPUT: NOTE: In the above code i used k=20-i, you can use any number in place of 20 but the number should be more than the total number of asterisk(*) present in the last line of triangle pattern . ...
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