Question 14 : Write a program in Java to print the following pattern :
1
12
123
1234
12345
1
12
123
1234
12345
Java Program :
public class pattern_3
{
public static void main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(j);
}
System.out.print("\n");
}
}
}
Can you help me with this
ReplyDelete0
00
111
1111
This comment has been removed by the author.
Deleteimport java.io.*;
Deleteclass ser
{
public static void main(String args[])throws IOException
{
DataInputStream in=new DataInputStream(System.in);
int a=1;
for(int i=1;i<=4;i++)
{
for(int j=1;j<=i;j++)
{
if(a<=3)
System.out.print(0);
else
System.out.print(1);
a++;
}
System.out.println();
}
}
}
Pls help me with the following two programmes
Delete1. WAP to print the following series:- 2,8,23,821,652,.........n
2. WAP to accept a sentence from the user and dislay the words the have consecutive alphabets in them.
pattern
ReplyDelete- - - 1
- -1 2
- 1 2 3
1 2 3 4
How to print
ReplyDelete1
&&
123
&&&&
1234
how to print 1+12+123....+n using for loop
ReplyDeleteplease slove this
ReplyDelete* *
** **
*** ***
*******
*** ***
** **
* *
Thanks for this post.
ReplyDeleteNumber Pattern Programs in Java .
12345
ReplyDelete2345
345
45
5
This comment has been removed by the author.
DeleteReaders request 7
DeleteHope this helps !!!
Class pattern
Delete{
Public static void main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=i;j<=5;j++)
{
System.out.println(j);
}
System.out.println(" ");
}
}
}
12345
ReplyDelete2345
345
34
3
Wap to find the sum of series 1+(1×2)+2+(1×2×3)+3+...9
ReplyDelete1
ReplyDelete12
123
Any one plz do this program
ReplyDelete1 1
12 21
123321