fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5.  
  6. int row;
  7. cout << "Enter the No of rows: \n";
  8. cin >> row;
  9.  
  10. for( int i = 0; i < row; i++ ) {
  11. for( int j = 0; j <= i; j++ ){
  12. cout << "* ";
  13. }
  14. cout<<endl;
  15. }
  16. cout<<"\n";
  17.  
  18. for( int i = 0; i < row; i++ ) {
  19. for( int j = 0; j <= i; j++ ){
  20. cout << i + 1 << " ";
  21. }
  22. cout<<endl;
  23. }
  24. cout<<"\n";
  25. for( int i = 0; i < row; i++ ) {
  26. for( int j = 0; j <= i; j++ ){
  27. cout << (char)('A' + j) << " ";
  28. }
  29. cout<<endl;
  30. }
  31. cout<<"\n";
  32. int counter = 1;
  33. for( int i = 0; i < row; i++ ) {
  34. for( int j = 0; j <= i; j++ ){
  35. cout << (counter++) << " ";
  36. }
  37. cout << endl;
  38. }
  39. cout<<"\n";
  40.  
  41. for( int i = 0; i < row; i++){
  42. int spaces = row - i;
  43. for( int j = 0; j < spaces; j++){
  44. cout<<" ";
  45. }
  46.  
  47. int coefficient;
  48. for( int j = 0; j <= i; j++){
  49.  
  50. if( j == 0 )
  51. coefficient = 1;
  52. else
  53. coefficient = coefficient * (i - j + 1) / j;
  54.  
  55. cout << coefficient << " ";
  56. }
  57.  
  58. cout << endl;
  59. }
  60.  
  61. return 0;
  62. }
  63.  
  64.  
  65.  
  66.  
Success #stdin #stdout 0.01s 5280KB
stdin
5
stdout
Enter the No of rows: 
*  
*  *  
*  *  *  
*  *  *  *  
*  *  *  *  *  

1 
2 2 
3 3 3 
4 4 4 4 
5 5 5 5 5 

A 
A B 
A B C 
A B C D 
A B C D E 

1 
2 3 
4 5 6 
7 8 9 10 
11 12 13 14 15 

          1   
        1   1   
      1   2   1   
    1   3   3   1   
  1   4   6   4   1