Question 21 : Write a program in Java to print the following pattern :
11111
2222
333
44
5
Java Program :
public class pattern_8
{
public static void main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
System.out.print(i);
}
System.out.print("\n");
}
}
}
I can't sense you all. Please comment.
ReplyDeleteYou can even put down your class 10 programming questions that you couldn't solve and I'll try it out and if I am successful, I'll post it in my blog as "User's Request" if you like.
ReplyDeleteWrite a program to print the following pattern
Delete11111
11111
11111
11111
11111
Pls reply soon i hv another question also and i dont know where will u reply pls notify me
Deletehow to print pattern with n in parameter list
ReplyDelete1
121
12321
1234321
123454321
where n is 5
class kilp
Delete{
public static void main (int n)
{
int j;
for(int i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
System.out.print (j);
}
for(int z=j-1;z>1;z--)
{
System.out.print(z-1);
}
System.out.println();
}
}
}
how to print the following pattern
ReplyDelete1
10
101
1010
10101
class Prog22
Delete{
public static void main(String args[])
{
int i,j,calc;
for(i=1;i<=5;i++)
{
for(j=0;j<i;j++)
{
calc=(i+j)%2;
System.out.print(calc);
}
System.out.println();
}
}
}
Another way of doing the code
Deleteimport java.io.*;
class assignment_17
{
public static void main ()
{
int i, j;
System.out.println("The Pattern is:");
for (i=1;i<=5;i++)
{
for (j=1;j<=i;j++)
{
if (j%2==0)
System.out.print("0"+ " ");
else
System.out.print("1"+ " ");
}
System.out.println ();
}
}
}
how to print this programme
ReplyDelete$
###
>>>>>
<<<<<<<<
?????????
This can be done only by one method:-
Deleteclass c
{
public static void main()
{
for(int i=1;i<=9;i+=2)
{
if(i==1)
{
System.out.println("$");
}
else if(i==3)
{
System.out.println("###");
}
else if(i==5)
{
System.out.println(">>>>>");
}
else if(i==7)
{
System.out.println("<<<<<<<");
}
else if(i==9)
{
System.out.println("?????????");
}
}
}
}
public class pattern
Delete{
public static void main(String args[])
{
int i, j;
System. out. printing("The Pattern ") ;
for(i=1;i<=5;i++)
{
for (j=1;j<=1;j++)
{
if(j%2==0)
System. out. println("0"+"") ;
else
System. out println("1"+"") ;
}
System. out. println() ;
}
}
}
Please give me the solution:-
ReplyDeleteE
DE
CDE
BCDE
ABCDE
Please give me the solution:-
ReplyDeleteE
DE
CDE
BCDE
ABCDE
*
ReplyDelete**
***
****
***
**
*
Pls help
Here is your requested code I hope it helps
Deleteimport java.io.*;
class asteriskpattern
{
public static void main()
{
int i, j,k,l;
for(i=1; i<=5; i++)
{
for(j=1; j=1;k--)
{
for(l=1;l<=k;l++)
{
System.out.print("*");
}
System.out.println();
}
}
}
can u print this please
ReplyDelete1
10
101
1010
10101
import java.io.*;
Deleteclass pattern
{
public static void main ()
{
int i, j;
System.out.println("The Pattern is:");
for (i=1;i<=5;i++)
{
for (j=1;j<=i;j++)
{
if (j%2==0)
System.out.print("0"+ " ");
else
System.out.print("1"+ " ");
}
System.out.println ();
}
}
}
This comment has been removed by the author.
ReplyDeleteclass prog1
ReplyDelete{
static void main()
{
char ch='E';
int n=5;
char ch1;
int temp=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{System.out.print(ch);
ch+=1;
temp= (int)ch-(j+1);
}
ch=(char)temp;
System.out.println();
}
}
PS: this is the solution to alok apan's question
Please give the solution
ReplyDelete11
12 22
13 23 33
14 24 34 44
15 25 35 45 55
12345
ReplyDeleteABCD
123
AB
1
This article regarding Print Star Pattern in Java is common for every java learner and thanks for sharing above codes in java programming.
ReplyDelete* *
* * * *
* * * * * * * *
* * * * * * * * * * * * * * * *
Please give code for above pattern