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

What is the difference between equals() and?

1263


What do you understand by the term polymorphism?

1141


What is basic syntax?

1112


Explain the hierarchy of java exception classes?

1187


Java.util.regex consists of which classes?

1047


If we allocate the memory using 'new' & de-allocated using 'free' then what will happen?

1092


Is java ee a framework?

1030


What is the use of callablestatement?

1058


In how many ways we can create threads in java?

1277


What do you mean by synchronized non access modifier?

1050


What is meant by method overriding?

1172


Can we make constructors static?

1291


What is the difference between a checked and an unchecked exception?

1045


explain the concept of virtual method invocation in polymorphism in detail?

2273


How many types of array are there?

1055