Pattern programs in java part 1: Simple loop programs
Pattern programs in Java part 1: solved Java program for ICSE Class 10 Computer Applications with complete BlueJ code, explanation and sample output.
Pattern programs in java.
Click to learn more Patterns
111
111
111
111
111
package Patterns;
class pattern
{
public static void main()
{
for(int i=1;i<=5;i++)
{
for(int j=1;j<=3;j++)
{
System.out.print("1");
}
System.out.println();
}
}
}Pattern 2
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
package Patterns;
class pattern4
{
public static void main()
{
int k=1;
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(k);
k++;
}
System.out.println();
}
}
}Pattern 3
1
22
333
4444
55555
package Patterns;
class pattern5
{
public static void main()
{
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(i);
}
System.out.println();
}
}
}Pattern 4
1
21
321
4321
54321
package Patterns;
class pattern9
{
public static void main()
{
for(int i=1;i<=5;i++)
{
int k=i;
for(int j=1;j<=i;j++)
{
System.out.print(k);
k--;
}
System.out.println();
}
}
}Pattern 5
54321
5432
543
54
5
package Patterns;
class pattern7
{
public static void main()
{
for(int i=1;i<=5;i++)
{
for(int j=5;j>=i;j--)
{
System.out.print(j);
}
System.out.println();
}
}
}Watch java videos
Related Posts
Continue learning with these related articles
Sum of First n Natural Numbers in Java (Loop and Formula)
Find the sum of the first n natural numbers in Java with a for loop, a while loop and the formula n(n + 1)/2, with a dry run and the sums of even numbers, odd numbers, squares and cubes.
Prime Number Program in Java: Check a Number and Print Primes in a Range
Check whether a number is prime in Java by counting its factors, a faster square-root method with isPrime(), and a program that prints all prime numbers in a range.

Encapsulation, Access Specifiers and Scope of Variables in Java for ICSE Class 10
ICSE Class 10 Computer Applications notes on encapsulation: private, default, protected and public access, data hiding with getter and setter methods, instance vs static (class) variables, local variables and scope, with a solved BankAccount program.