Output
Import Java.util.scanner;public class Text10{public static void Main (string[] args) {Scanner sc=new Scanner (system.in); int I,j,n;n=sc.nextint (); for (i=1;i<=n;i++) {for (j=1;j<=n;j++) {System.out.print (i);} System.out.println ();}}}
Output Pyramid * No.
Import Java.util.scanner;public class Text11 {public static void main (string[] args) { Scanner sc=new Scanner (System. in); int i,j,n; N=sc.nextint (); for (i=1;i<=n;i++) {for (j=1;j<=n-i;j++) System.out.print ("); for (j=1;j<=2*i-1;j++) System.out.print (' * '); System.out.println ();}}}
Output
Import Java.util.scanner;public class Text12 {public static void main (string[] args) { Scanner sc=new Scanner (System. in); int i,j,n; N=sc.nextint (); for (i=1;i<=n;i++) {for (j=1;j<=i;j++) System.out.print (j); System.out.println ();}}}
Output
Import Java.util.scanner;public class Text13 {public static void main (string[] args) { Scanner sc=new Scanner (System. in); int i,j,n; N=sc.nextint (); for (i=n;i>=1;i--) {for (j=1;j<=n-i;j++) System.out.print ("); for (j=1;j<=i;j++) System.out.print (j); System.out.println ();}}}
Output
Import Java.util.scanner;public class Text14 {public static void main (string[] args) { Scanner sc=new Scanner (System. in); int i,j,n; N=sc.nextint (); for (i=1;i<=n;i++) {for (j=n-i;j>=1;j--) System.out.print ("); for (j=1;j<=2*i-1;j++) System.out.print (i); System.out.println (); } for (i=n-1;i>=1;i--) {for (j=n-i;j>=1;j--) System.out.print ("); for (j=1;j<=2*i-1;j++) System.out.print (i); System.out.println ();}}}
Output
Import Java.util.scanner;public class Text15 {public static void main (string[] args) { Scanner sc=new Scanner (System. in); int i,j,n; N=sc.nextint (); for (i=1;i<=n;i++) {for (j=n-i;j>=1;j--) System.out.print ("); System.out.print (i); for (j=2*i-3;j>=1;j--) System.out.print ("); if (i!=1) System.out.print (i); System.out.println (); } for (i=n-1;i>=1;i--) {for (j=n-i;j>=1;j--) System.out.print ("); System.out.print (i); for (j=2*i-3;j>=1;j--) System.out.print ("); if (i!=1) System.out.print (i); System.out.println ();}}}
One- , two-, five-minute coins are exchanged for a dollar note, and the total number of coins required for redemption is -how many kinds of redemption methods are there? How many coins are used for each method of redemption?
public class Text16 {public static void main (string[] args) { int x, y, Z; for (x=0;x<=50;x++) for ( y=0;y<=50;y++) for ( z=0;z<=50;z++) if (x+y+z==50) System.out.println ( "One point =" +x+ "two points =" +y+ "Five points =" +z ";}}
Java loop structure (b) for the use of the For statement, the following example allows you to fully understand the For loop