Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main (){
- int a,b,c=5;
- for (a=1;a<=5;a++) {
- for (b=1;b<=a;b++) {
- cout <<"*";
- }
- cout << endl;
- }
- for (a=2;a<=5;a++) {
- for (b=a;b<=5;b++) {
- cout << "*";
- }
- cout << endl;
- }
- cout<<endl;
- for (a=1;a<5;a++){
- for(b=1;b<=5;b++){
- cout<<"*"<<" ";
- }
- cout<<endl;
- }
- cout<<endl;
- for(a=5;a>=1;a--){
- for(b=a;b>1;b--){
- if (a==c||b==a)
- cout<<"*"<<" ";
- else
- cout<<" ";
- }
- for(b=1;b<=c-a+1;b++){
- if(a==1||b==c-a+1)
- cout<<"*"<<" ";
- else
- cout<<" ";
- }
- cout<<endl;
- }
- cout<<endl;
- for(a=1;a<=5;a++){
- for(b=1;b<=5;b++){
- if (a==3||b==1||b==5){
- cout<<"*";
- }
- else {
- cout<<" ";
- }
- }
- cout<<endl;
- }
- cout<<endl;
- for(a=1;a<=5;a++){
- for(b=1;b<=5;b++){
- if (a==3||b==1||a==1){
- cout<<"*";
- }
- else {
- cout<<" ";
- }
- }
- cout<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment