Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // In ra tam giac can nguoc rong ruot
- // Khai bao chuong trinh nhu sau
- #include <iostream.h>
- void main()
- {
- int n;
- cout <<"Nhap kich thuoc tam giac: "; cin>>n;
- cout <<"\n\n";
- int a=(2*n-1);
- int b=(a /2+1);
- for (int i=1;i<=n;i++)
- {
- for (int j=1;j<=a;j++)
- {
- if (i==1)
- {
- if ((j%2)!=0) cout <<"*";
- else cout <<" ";
- }
- else if ((j==i) || (j==a+1-i)) cout <<"*";
- else cout <<" ";
- }
- cout <<"\n";
- }
- cout <<"\n\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement