write a java program to print the pattern :
1
12
123
Answers
Answered by
3
Answer:
public class Pattern
public class Pattern{
public class Pattern{public static void main(String args[])
public class Pattern{public static void main(String args[]){
public class Pattern{public static void main(String args[]){int a,b;
public class Pattern{public static void main(String args[]){int a,b;for(a=1;a<=3;a++)
public class Pattern{public static void main(String args[]){int a,b;for(a=1;a<=3;a++){
public class Pattern{public static void main(String args[]){int a,b;for(a=1;a<=3;a++){for(b=1;b<=a;b++)
public class Pattern{public static void main(String args[]){int a,b;for(a=1;a<=3;a++){for(b=1;b<=a;b++){
public class Pattern{public static void main(String args[]){int a,b;for(a=1;a<=3;a++){for(b=1;b<=a;b++){System.out.print(b);
public class Pattern{public static void main(String args[]){int a,b;for(a=1;a<=3;a++){for(b=1;b<=a;b++){System.out.print(b);}
public class Pattern{public static void main(String args[]){int a,b;for(a=1;a<=3;a++){for(b=1;b<=a;b++){System.out.print(b);}System.out.println("");
public class Pattern{public static void main(String args[]){int a,b;for(a=1;a<=3;a++){for(b=1;b<=a;b++){System.out.print(b);}System.out.println("");}
public class Pattern{public static void main(String args[]){int a,b;for(a=1;a<=3;a++){for(b=1;b<=a;b++){System.out.print(b);}System.out.println("");}}
public class Pattern{public static void main(String args[]){int a,b;for(a=1;a<=3;a++){for(b=1;b<=a;b++){System.out.print(b);}System.out.println("");}}}
Explanation:
Hope this mark as brainliest.
Answered by
4
Given pattern:-
1
12
123
Hint:-
- Each row increases numerically by 1
- The last elements of each row also increases numerically by 1
- It means outer loop will run from 1 to 3(or no. of lines of the pattern)
- inner loop will run from 1 to outer loop value
Approach
class patt{
public static void main (String ar []){
for(int I=1;I<=3;I++){
for(int j=1;j<=I;j++)
System.out.print(j);
System.out.ptintln();
}
}
}
Note:-
- For n no. of lines simply change condition in outer loop from I<=3 to I<=n taking no. of lines as input .
Similar questions