Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream.h>
- #include <conio.h>
- int main()
- {
- int a,i,j,d,z,n;
- char c;
- cout<<"Introdu numarul: ";cin>>a;
- cout<<"Introdu caracterul :";cin>>c;
- d = -1;
- if(a%2 == 0)
- a++;
- for(i = 1; i<=a/2+1; i++)
- {
- d++;
- cout<<endl;
- for(j = 1; j<=a; j++)
- {
- if(j >= (a/2+1)-d && j <= (a/2+1)+d)
- cout<<c;
- else
- cout<<" ";
- }
- }
- d = a-1;
- n = 0;
- for(i = a/2; i >= 1; i--)
- {
- n++;
- cout<<endl;
- for(j = 1; j<=a; j++)
- {
- if(j<=d && j > n)
- cout<<c;
- else
- cout<<" ";
- }
- d--;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement