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...

Tell me the programme for this


@
1 2
@ @ @
1 2 3 4

Answer Posted / chantiraji

public class TriangleDisplay {

public static void main(String[] args) {
int n = 4;
for (int i = 1; i <= n; i++) {
for (int j = 4; j < 2 * n - i; j++) {
System.out.print(" ");
}
for (int j = 1; j <= i; j++) {
if (i % 2 != 0) {
System.out.print("@" + " ");
} else {
System.out.print(j + " ");
}
}
System.out.println();
}
}
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Suppose if we have variable ' I ' in run method, if I can create one or more thread each thread will occupy a separate copy or same variable will be shared?

995


What is the difference between multiple processes and multiple threads?

1115


What is the statements?

1042


Explain what is Marker interface?

1038


What is a hashmap used for?

1177


Can I learn java without any programming experience?

984


What is busy spin, and why should you use it?

1024


How will you invoke any external process in java?

1048


Can a set contain duplicates?

906


Is empty in java?

995


What are abstract classes and anonymous classes?

1028


What is the difference between an interface and an abstract class?

952


What are different ways of object creation in java ?

1020


Can inner class have constructor?

991


how to prepare for IT Officers Interview in Banks

1914