#include <string.h>
#include <iostream.h>
#include <conio.h>int main(){
int u,v, k;
int n = 0;
cout<<"Program for displaying pattern of *.\n";
cout<<"Enter the width of square: ";
cin>>n;
cout<<"Enter the length of square: ";
cin>>v;
cout<<"\nHere is the square of Stars\n";
for (int i = 1; i <= n+3; i++)
{ cout<<"*";
} cout<<endl;
for (int i = 1; i <= n+3; i++)
{ cout<<"*";
} cout<<endl;
for (int i = 1; i <= v; i++)
{ cout<<"**";
for (int i = 1; i <= n-1; i++)
{ cout<<" ";}
cout<<"**"<<endl;
}
for (int i = 1; i <= n+3; i++)
{ cout<<"*";
} cout<<endl;
for (int i = 1; i <= n+3; i++)
{ cout<<"*";
}
getch();
return 0;}
#include <iostream.h>
#include <conio.h>int main(){
int u,v, k;
int n = 0;
cout<<"Program for displaying pattern of *.\n";
cout<<"Enter the width of square: ";
cin>>n;
cout<<"Enter the length of square: ";
cin>>v;
cout<<"\nHere is the square of Stars\n";
for (int i = 1; i <= n+3; i++)
{ cout<<"*";
} cout<<endl;
for (int i = 1; i <= n+3; i++)
{ cout<<"*";
} cout<<endl;
for (int i = 1; i <= v; i++)
{ cout<<"**";
for (int i = 1; i <= n-1; i++)
{ cout<<" ";}
cout<<"**"<<endl;
}
for (int i = 1; i <= n+3; i++)
{ cout<<"*";
} cout<<endl;
for (int i = 1; i <= n+3; i++)
{ cout<<"*";
}
getch();
return 0;}
No comments:
Post a Comment