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 polymorphism and its types?

1130


Can we create object of interface?

1176


What is ambiguity in inheritance?

1172


Which language is pure oop?

1074


Can a destructor be called directly?

1137


Are polymorphisms mutations?

1216


Can you inherit a private class?

1144


What exactly is polymorphism?

1188


what's the basic's in dot net

2235


What is stream in oop?

1361


assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).

2180


What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?

2203


What is abstraction in oops?

1097


write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.

2299


What is encapsulation with real life example?

1089