do the following pattern in BLUE J
hint is given...i will mark brainliest..
Attachments:
Answers
Answered by
8
CODE :
class pattern
{
public static void main(String args[])
{
int v=1;
for(int i=1;i<=5;i++)
{
for(int j=1;j<i;j++)
{
System.out.print(" ");
}
for(int k=5;k>=i;k--)
{
System.out.print(v++%10);
}
System.out.println();
}
}
}
OUTPUT :
12345
6789
012
34
5
//Why did you have to write that hint ? xD
bidisha19:
my whim
Answered by
1
Program:
class Solution
{
public static void main(String args[])
{
int v=1;
for(int i=1;i<=5;i++)
{
for(int j=1;j<i;j++)
{
System.out.print(" ");
}
for(int k=5;k>=i;k--)
{
System.out.print(v++%10);
}
System.out.println();
}
}
}.
This program has been successfully compiled in BlueJ.
Similar questions