Computer Science, asked by manoj116876, 1 year ago

How to print a pattern in Java.
class 10 ICSE
1
12
123

Answers

Answered by 31shivani
1
class abc
{
Public void main ()
{
for(int x=1; x<=3;x++)
{
for(int y=1;y<=x; y++)
{
System.out.print(y) ;
}
System.out.println() ;
}}}
HOPE IT IS HELPFUL IF SO PLZ MARK AS BRAINLIEST.
Answered by Anonymous
2
int r , c;
for (r = 1 ; r <=3 ; r++)
{
for ( c = 1 ; c <=r ; c++)
System.out.print(c);
System.out.println( );
}

I HAVE JUST WRITTEN THE LOGIC
HOPE IT HELPS U.......
THANKS...........
☆☆☆☆☆☆☆☆☆☆☆

Anonymous: the condition will allow only one to print
Anonymous: and after printing 1 the value of r will increase
Anonymous: it will increase to 2
Anonymous: and now the second condition will allow u to print 2 digits
Anonymous: we have to go accordingly
Anonymous: hope this much is enough and helpful
manoj116876: Thank yo
Anonymous: wlc and thank for brainliest
manoj116876: Ma'am plz help me for all my ans
Anonymous: ok i will
Similar questions