Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Dimonds Printing
- // Date : 15.07.19
- #include<iostream>
- using namespace std;
- int main(){
- int n; cin >> n;
- int k = 3;
- for(int i = 0; i < n; i++){
- for(int j = 0; j < n-i; j++){
- cout << ' ';
- }
- if(i == 0) { cout << '*'; }
- else{
- for(int j = 0; j < k; j++){
- cout << '*';
- }
- k += 2;
- }
- cout << endl;
- }
- k -= 4;
- for(int i = 0; i < n-1; i++){
- for(int j = -1; j <= i; j++){
- cout << ' ';
- }
- if(i == n-2) { cout << '*'; }
- else{
- for(int j = 0; j < k; j++){
- cout << '*';
- }
- k -= 2;
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment