Write a program in C++ to make such a pattern like a pyramid with a number which will repeat the number in the same row. .


#include <iostream>
using namespace std;
void main()
{
  int i,j,spc,rows,k;
   cout<<"Input number of rows : ";
   cin>>rows;
   spc=rows+4-1;
   for(i=1;i<=rows;i++)
   {
         for(k=spc;k>=1;k--)
            {
              cout<<" ";
            }
                     
  for(j=1;j<=i;j++)
  cout<<" "<<i;
cout<<"\n";
    spc--;
   }
       system ("pause");
}
Write a program in C++ to make such a pattern like a pyramid with a number which will repeat the number in the same row. . Write a program in C++ to make such a pattern like a pyramid with a number which will repeat the number in the same row. . Reviewed by Unknown on May 18, 2017 Rating: 5

No comments:

Powered by Blogger.