Write a program in C++ to make such a pattern like a pyramid with numbers increased by 1. .


#include <iostream>
using namespace std;
void main()
{
int i,j,spc,rows,k,t=1;
   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<<" "<<t++;
  cout<<endl;
    spc--;
   }
       system ("pause");
}
Write a program in C++ to make such a pattern like a pyramid with numbers increased by 1. . Write a program in C++ to make such a pattern like a pyramid with numbers increased by 1. . Reviewed by Unknown on May 18, 2017 Rating: 5

No comments:

Powered by Blogger.