Sie sind auf Seite 1von 2

#include <iostream> using namespace std; int main(){ int i,j; for (i=1;i<=6;i=i+1) for(j=1;j<=i;j=j+1) cout<<"*"<<endl;

#include <iostream> using namespace std; int main() { int i=1; while(i<=6) { int j=1; while (j<=i) cout<<"x"; j=j+1; cout<<"\n";} i=i+1; }

Patterns Down pattern


#include <iostream> using namespace std; int main(){ int i,j; for (i=1;i<=6;i=i+1) { for(j=1;j<=i;j=j+1) cout<<"*"<<endl; cout<<"\n"; }

#include<iostream> using namespace std; int main() { int row, c, n, temp; cout<<"Enter the number of rows in pyramid of stars you wish to see="; cin>>n; temp = n; for ( row = 1 ; row <= n ; row++ ) { for ( c = 1 ; c < temp ; c++ ) temp--; for ( c = 1 ; c <= 2*row - 1 ; c++ ) cout<<"*"<<endl; cout<<endl; } return 0; }

#include <iostream> using namespace std; int main() {int i; for(i=1;i<=3;i=i+1) { cout<<"i="<<i<<endl; } }

#include <iostream> using namespace std; int main() { int i=1; while(i<=3) {cout<<i<<endl; i=i+1; } }

Das könnte Ihnen auch gefallen