Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- char c;
- int n;
- cin >> c >> n;
- int sum = 0;
- for (int i = n; i < 2 * n; i++) {
- sum += i;
- }
- int x = n - 1, y = 1;
- cout << sum << endl;
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < x; j++) {
- cout << ' ';
- }
- for (int j = 0; j < y; j++) {
- cout << c;
- }
- cout << endl;
- x--;
- y += 2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement