1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| /* Display Triangle as follow : BREAK DEMO.
1
2 3
4 5 6
7 8 9 10 ... N */
class Output1{
public static void main(String args[]){
int c=0;
int n = Integer.parseInt(args[0]);
loop1: for(int i=1;i<=n;i++){
loop2: for(int j=1;j<=i;j++){
if(c!=n){
c++;
System.out.print(c+" ");
}
else
break loop1;
}
System.out.print("\n");
}
}
} |
/* Display Triangle as follow : BREAK DEMO.
1
2 3
4 5 6
7 8 9 10 ... N */
class Output1{
public static void main(String args[]){
int c=0;
int n = Integer.parseInt(args[0]);
loop1: for(int i=1;i<=n;i++){
loop2: for(int j=1;j<=i;j++){
if(c!=n){
c++;
System.out.print(c+" ");
}
else
break loop1;
}
System.out.print("\n");
}
}
}
this is bad site please stop it. because nobody can not see the actual code because your advertisement is disturb a lot . which is display on code.please remove it.
can you write java code to display triangle shape with 78910 456 23 1
can you write a String array .. like Triangle Shape . String array contain. 12345678910.