Display the pattern like right Triagle with a number program in java
1
12
123
1234
12345
123456
1234567
12345678
123456789
12345678910
12345678910
123456789
12345678
1234567
123456
12345
1234
123
12
1
10987654321
987654321
87654321
7654321
654321
54321
4321
321
21
1
for(a=12;a<1;a--)
for(b=12;b<a;b--)
System.out.println(b);
if (a==b){
System.out.println();
}
*
**
***
class star
{
public static void main(String[] args)
{
int a;
for(a=0;a<10;a++)
{
System.out.print("*");
while(a=<10)
{
System.out.println("*");
a--;
}}
}
No comments:
Post a Comment