Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a, i = 0, s, l = 1, l_n;
- cout << "enter a number: ";
- cin >> a;
- while (i < a) {
- i++;
- s = a - i;
- while (s > 0) {
- cout << " ";
- s--;
- }
- l_n = l;
- while (l_n > 0) {
- cout << "*";
- l_n--;
- }
- l = l + 2;
- cout << endl;
- }
- s = a - 1;
- while (s > 0) {
- cout << " ";
- s--;
- }
- cout << "*";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement