Program to print Abcd pattern in java programming:
import java.util.*;
Program1:
class Pattern1
{
public static void main(String args[])
{
int i,j;
int n=5;
System.out.println("a3programming.blogspot.com");
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
System.out.print((char)(i+64));
}
System.out.println("");
}
}
}
Expected output is:
Program 2:
import java.util.*;
Program1:
class Pattern1
{
public static void main(String args[])
{
int i,j;
int n=5;
System.out.println("a3programming.blogspot.com");
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
System.out.print((char)(i+64));
}
System.out.println("");
}
}
}
Expected output is:
import java.util.*;
class Pattern2
{
public static void main(String args[])
{
int i,j;
int n=5;
System.out.println("a3programming.blogspot.com");
for(i=1;i<=n;i++)
{
for(j=i;j<=n;j++)
{
System.out.print((char)(i+64));
}
System.out.println("");
}
}
}
Expected output is:
Program 3:
import java.util.*;
class Pattern3
{
public static void main(String args[])
{
int i,j;
int n=5;
System.out.println("a3programming.blogspot.com");
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
System.out.print((char)(j+64));
}
System.out.println("");
}
}
}
Expected output is:
Program 4:
import java.util.*;
class Pattern4
{
public static void main(String args[])
{
int i,j;
int n=5;
System.out.println("a3programming.blogspot.com");
for(i=n;i>=1;i--)
{
for(j=i;j<=n;j++)
{
System.out.print((char)(j+64));
}
System.out.println("");
}
}
}
Expected output is:
0 Comments