fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. cout << "Enter a positive integer" << endl;
  7. int n;
  8. cin >> n;
  9. if (!cin)
  10. {
  11. cerr << "Not an integer" << endl;
  12. return 1;
  13. }
  14. while (n > 0)
  15. {
  16. int c = 0;
  17. while (c < n)
  18. {
  19. cout << "*";
  20. c = c + 1;
  21. }
  22. n = n - 1;
  23. cout << endl;
  24. }
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 3300KB
stdin
5
stdout
Enter a positive integer
*****
****
***
**
*