Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a program to accept a number and to print numbers in
pyramid format?
for eg:for a no. 5
1
212
32123
4321234
543212345

Answer Posted / abhi

#include<iostream.h>
using namespace std;
int main()
{
int n,i=1,j;

cout<<"Enter no of rows:";
cin>>n;

for(;i<=n;i++)
{
for(int k=1;k<i-1;k++)
cout<<" ";//for spaces from right
for(j=i;j>0;j--)
cout<<j;//prints rightside nums
for(int l=2;l<=i;l++)
cout<<l;//prints leftside nums
cout<<endl;
}
return 0;
}

Is This Answer Correct ?    9 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we need oop?

1169


What is abstraction in oop with example?

1103


What is protected in oop?

1047


What do you mean by abstraction?

1053


What is multilevel inheritance explain with example?

1131


What is the important feature of inheritance?

1111


What is class and object with example?

1110


Whats is abstraction in oops?

1054


How do you achieve polymorphism?

1066


Which is better struts or spring?

1033


What is advantage of inheritance?

1164


Write a c++ program to display pass and fail for three student using static member function

3379


What is an example of genetic polymorphism?

1162


What does oop mean in snapchat?

1215


write knight tour problem which is present in datastructure

2636