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 / pravin pawar

public static void main(String args[])
{
for(int r=1;r<=5;r++)
{
for(int s=5-r;s>0;s--)

System.out.print(" ");

for(int c=r;c>=1;c--)
System.out.print(c);

for(int c=2;c<=r;c++)

System.out.print(c);

System.out.print("\n");
}
}

Is This Answer Correct ?    8 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is this pointer in oop?

997


What is object-oriented programming? Webopedia definition

1174


What is abstraction in oops?

978


What are the types of abstraction?

992


What is for loop and its syntax?

1033


State what is encapsulation and friend function?

1190


What is oops?what is its use in software engineering?

971


what are the different types of qualifier in java?

2216


What is object in oops?

1019


What is the difference between encapsulation and polymorphism?

1043


when to use 'mutable' keyword and when to use 'const cast' in c++

2107


What language is oop?

960


what is the drawback of classical methods in oops?

3315


What is the main feature of oop?

1097


What are constructors in oop?

1081