WAP In JAVA to print the following series/pattern.
1)
1
11
111
1111
11111
2)
11111
11111
11111
11111
11111
Answers
Answered by
5
Solution to the first program is as follows:-
class pattern1
{
public static void main()
{
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print("1");
}
System.out.println();
}
}
}
Solution for the second program is :-
class pattern2
{
public static void main()
{
for(int i=1;i<=5;i++)
{
for(int j=1;j<=5;j++)
{
System.out.print("1");
}
System.out.println();
}
}
}
Thank YOu
HOPE this helps!!
class pattern1
{
public static void main()
{
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print("1");
}
System.out.println();
}
}
}
Solution for the second program is :-
class pattern2
{
public static void main()
{
for(int i=1;i<=5;i++)
{
for(int j=1;j<=5;j++)
{
System.out.print("1");
}
System.out.println();
}
}
}
Thank YOu
HOPE this helps!!
Answered by
0
1)
class anmol
{
public static void main(String args[])
{
int i, j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
System.out.print("1 ");
System.out.println();
}
}
}
2)
class anmol
{
public static void main(String args[])
{
int i, j;
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
System.out.print("1 ");
System.out.println();
}
}
}
HOPE IT HELPS
MARK ME AS BRAINLIEST
Similar questions
Social Sciences,
8 months ago
Social Sciences,
8 months ago
Physics,
8 months ago
Math,
1 year ago
English,
1 year ago
Math,
1 year ago
Biology,
1 year ago
Math,
1 year ago