fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main() {
  6. cout << "Enter the number" ;
  7. int n ;
  8. cin >> n ;
  9.  
  10. if(n%2 == 0)
  11. cout << "not allowed" ;
  12.  
  13. if(n == 1 || n <= -1){
  14. cout << "not allowed";
  15. }
  16.  
  17. for(int i = n ; i >= 1 ; i--){
  18. for(int j = 1 ; j <= i ;j++ ){
  19. if(j == 1 || j == i || i == n){
  20. cout << "@" ;
  21. }else{
  22. cout << " ";
  23. }
  24. }
  25. cout << endl ;
  26. }
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5288KB
stdin
4
stdout
Enter the numbernot allowed@@@@
@ @
@@
@