Write a program in java forming a pattern
12345
2345
345
45
5
Answers
Answered by
21
{
{
for(int i = 5 ; i>1 ;i--)
{
{
}
j++;
}
}
}//end program
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
_______________________________
_______________________________
print(): It is used to continue the sentence in the same line without changing the line
println(): sentence will start from the next line .
Attachments:
Anonymous:
Nice !
Answered by
40
class pattern
{
public static void main(String args[])
{
for(int i = 1 ; i < = 5 ; i++ )
{
for(int j = i ; j < = 5 ; j++ )
{
System.out.print(j+" ");
}
System.out.println();
}
}//end of main
}//end of class
Similar questions
Social Sciences,
6 months ago
Social Sciences,
1 year ago