├── README.md ├── LoopProb83.java ├── LoopProb01.java ├── LoopProb03.java ├── LoopProb06.java ├── LoopProb10.java ├── LoopProb28.java ├── LoopProb09.java ├── LoopProb58.java ├── LoopProb20.java ├── LoopProb07.java ├── LoopProb08.java ├── LoopProb11.java ├── LoopProb15.java ├── LoopProb55.java ├── LoopProb73.java ├── LoopProb76.java ├── LoopProb22.java ├── LoopProb74.java ├── LoopProb57.java ├── LoopProb67.java ├── LoopProb13.java ├── LoopProb14.java ├── LoopProb32.java ├── LoopProb33.java ├── LoopProb05.java ├── LoopProb89.java ├── LoopProb43.java ├── LoopProb88.java ├── LoopProb02.java ├── LoopProb48.java ├── LoopProb50.java ├── LoopProb04.java ├── LoopProb60.java ├── LoopProb12.java ├── LoopProb19.java ├── LoopProb26.java ├── LoopProb53.java ├── LoopProb61.java ├── LoopProb68.java ├── LoopProb72.java ├── LoopProb31.java ├── LoopProb84.java ├── LoopProb30.java ├── LoopProb79.java ├── LoopProb45.java ├── LoopProb16.java ├── LoopProb25.java ├── LoopProb63.java ├── LoopProb27.java ├── LoopProb81.java ├── LoopProb64.java ├── LoopProb70.java ├── LoopProb69.java ├── LoopProb42.java ├── LoopProb94.java ├── LoopProb59.java ├── LoopProb54.java ├── LoopProb23.java ├── LoopProb38.java ├── LoopProb17.java ├── LoopProb29.java ├── LoopProb71.java ├── LoopProb24.java ├── LoopProb49.java ├── LoopProb51.java ├── LoopProb86.java ├── LoopProb39.java ├── LoopProb85.java ├── LoopProb56.java ├── LoopProb18.java ├── LoopProb92.java ├── LoopProb46.java ├── LoopProb91.java ├── LoopProb75.java ├── LoopProb77.java ├── LoopProb47.java ├── LoopProb78.java ├── LoopProb90.java ├── LoopProb34.java ├── LoopProb93.java ├── LoopProb80.java ├── LoopProb44.java ├── LoopProb40.java ├── LoopProb82.java ├── LoopProb21.java ├── LoopProb62.java ├── LoopProb52.java ├── LoopProb87.java ├── LoopProb41.java ├── LoopProb36.java ├── LoopProb37.java ├── LoopProb35.java ├── LoopProb65.java ├── LoopProb66.java └── Pyramid.txt /README.md: -------------------------------------------------------------------------------- 1 | # Loop Problems 2 | -------------------------------------------------------------------------------- /LoopProb83.java: -------------------------------------------------------------------------------- 1 | public class LoopProb83 2 | { 3 | public static void main(String[] args) 4 | { 5 | int n=4; 6 | int[] a= new int[n]; 7 | 8 | a[0]=4; 9 | a[1]=5; 10 | a[2]=7; 11 | a[3]=2; 12 | 13 | System.out.println(); 14 | 15 | for(int i=0;ii;j--) 20 | { 21 | System.out.print(a[c]); 22 | c++; 23 | } 24 | System.out.println(); 25 | } 26 | System.out.println(); 27 | } 28 | } -------------------------------------------------------------------------------- /LoopProb01.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb01 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=1;j<=n;j++) 19 | { 20 | System.out.print("@"); 21 | } 22 | System.out.println(); 23 | } 24 | System.out.println(); 25 | } 26 | } -------------------------------------------------------------------------------- /LoopProb03.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb03 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=n;j>=i;j--) 19 | { 20 | System.out.print("@ "); 21 | } 22 | System.out.println(); 23 | } 24 | System.out.println(); 25 | } 26 | } -------------------------------------------------------------------------------- /LoopProb06.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb06 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=1;j<=n;j++) 19 | { 20 | System.out.print(j); 21 | } 22 | System.out.println(); 23 | } 24 | System.out.println(); 25 | } 26 | } -------------------------------------------------------------------------------- /LoopProb10.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb10 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=1;j<=i;j++) 19 | { 20 | System.out.print(j); 21 | } 22 | System.out.println(); 23 | } 24 | System.out.println(); 25 | } 26 | } -------------------------------------------------------------------------------- /LoopProb28.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb28 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=1;j<=i;j++) 19 | { 20 | System.out.print(i+" "); 21 | } 22 | System.out.println(); 23 | } 24 | System.out.println(); 25 | } 26 | } -------------------------------------------------------------------------------- /LoopProb09.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb09 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n,c=1; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=1;j<=n;j++) 19 | { 20 | System.out.print(c); 21 | } 22 | System.out.println(); 23 | c++; 24 | } 25 | System.out.println(); 26 | } 27 | } -------------------------------------------------------------------------------- /LoopProb58.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb58 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=n;j>=i;j--) 19 | { 20 | System.out.print(j); 21 | } 22 | System.out.println(); 23 | } 24 | System.out.println(); 25 | } 26 | } -------------------------------------------------------------------------------- /LoopProb20.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb20 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,c=1,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=1;j<=i;j++) 19 | { 20 | System.out.print(c+" "); 21 | c++; 22 | } 23 | System.out.println(); 24 | } 25 | System.out.println(); 26 | } 27 | } -------------------------------------------------------------------------------- /LoopProb07.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb07 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | int c=n; 19 | 20 | for(j=1;j<=n;j++) 21 | { 22 | System.out.print(c); 23 | c--; 24 | } 25 | System.out.println(); 26 | } 27 | System.out.println(); 28 | } 29 | } -------------------------------------------------------------------------------- /LoopProb08.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb08 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int c=n; 17 | 18 | for(i=1;i<=n;i++) 19 | { 20 | for(j=1;j<=n;j++) 21 | { 22 | System.out.print(c); 23 | } 24 | System.out.println(); 25 | c--; 26 | } 27 | System.out.println(); 28 | } 29 | } -------------------------------------------------------------------------------- /LoopProb11.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb11 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | int c=1; 19 | 20 | for(j=n;j>=i;j--) 21 | { 22 | System.out.print(c); 23 | c++; 24 | } 25 | System.out.println(); 26 | } 27 | System.out.println(); 28 | } 29 | } -------------------------------------------------------------------------------- /LoopProb15.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb15 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | int c=1; 19 | 20 | for(j=n;j>=i;j--) 21 | { 22 | System.out.print(c); 23 | c++; 24 | } 25 | System.out.println(); 26 | } 27 | System.out.println(); 28 | } 29 | } -------------------------------------------------------------------------------- /LoopProb55.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb55 4 | { 5 | public static void main(String[] args) 6 | { 7 | int n,i,j,m=1; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=1;j<=m;j++) 19 | { 20 | System.out.print("*"); 21 | } 22 | System.out.println(); 23 | m = i*3; 24 | } 25 | System.out.println(); 26 | } 27 | } -------------------------------------------------------------------------------- /LoopProb73.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb73 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | int m=1; 15 | 16 | for(int i=1;i<=n;i++) 17 | { 18 | for(int j=1;j<=m;j++) 19 | { 20 | System.out.print(j); 21 | } 22 | System.out.println(); 23 | m=m+2; 24 | } 25 | System.out.println(); 26 | } 27 | } -------------------------------------------------------------------------------- /LoopProb76.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb76 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | int c=1; 15 | 16 | for(int i=1;i<=n;i++) 17 | { 18 | for(int j=1;j<=i;j++) 19 | { 20 | System.out.print(c%2); 21 | c++; 22 | } 23 | System.out.println(); 24 | } 25 | System.out.println(); 26 | } 27 | } -------------------------------------------------------------------------------- /LoopProb22.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb22 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | char c='A'; 9 | 10 | Scanner sc = new Scanner(System.in); 11 | 12 | System.out.print("\nEnter The Number Of Row : "); 13 | n = sc.nextInt(); 14 | 15 | System.out.println(); 16 | 17 | for(i=1;i<=n;i++) 18 | { 19 | for(j=1;j<=i;j++) 20 | { 21 | System.out.print(c+" "); 22 | } 23 | System.out.println(); 24 | c++; 25 | } 26 | System.out.println(); 27 | } 28 | } -------------------------------------------------------------------------------- /LoopProb74.java: -------------------------------------------------------------------------------- 1 | public class LoopProb74 2 | { 3 | public static void main(String[] args) 4 | { 5 | int n=3,c=0; 6 | 7 | System.out.println(); 8 | 9 | for(int i=1;i<=n;i++) 10 | { 11 | for(int j=1;j<=n+1;j++) 12 | { 13 | if(j==1) 14 | { 15 | c=i; 16 | } 17 | else if(i==1 && j>1) 18 | { 19 | c=n; 20 | } 21 | else if(i==n && j==n+1) 22 | { 23 | c=1; 24 | } 25 | System.out.print(c); 26 | } 27 | System.out.println(); 28 | } 29 | System.out.println(); 30 | } 31 | } -------------------------------------------------------------------------------- /LoopProb57.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb57 4 | { 5 | public static void main(String[] args) 6 | { 7 | int n,i,j,c=1,m=1; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=1;j<=m;j++) 19 | { 20 | System.out.print(c+" "); 21 | c=c+2; 22 | } 23 | System.out.println(); 24 | m = i*3; 25 | } 26 | System.out.println(); 27 | } 28 | } -------------------------------------------------------------------------------- /LoopProb67.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb67 4 | { 5 | public static void main(String[] args) 6 | { 7 | int n,m=1; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int l=n+(n-1); 17 | 18 | for(int i=1;i<=n;i++) 19 | { 20 | for(int j=l;j>=m;j--) 21 | { 22 | System.out.print("*"); 23 | } 24 | m=m+2; 25 | System.out.println(); 26 | } 27 | System.out.println(); 28 | } 29 | } -------------------------------------------------------------------------------- /LoopProb13.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb13 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int k=n; 17 | 18 | for(i=1;i<=n;i++) 19 | { 20 | int c=k; 21 | 22 | for(j=n;j>=i;j--) 23 | { 24 | System.out.print(c); 25 | c--; 26 | } 27 | System.out.println(); 28 | k--; 29 | } 30 | System.out.println(); 31 | } 32 | } -------------------------------------------------------------------------------- /LoopProb14.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb14 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int k=1; 17 | 18 | for(i=1;i<=n;i++) 19 | { 20 | int c=k; 21 | 22 | for(j=1;j<=i;j++) 23 | { 24 | System.out.print(c); 25 | c--; 26 | } 27 | System.out.println(); 28 | k++; 29 | } 30 | System.out.println(); 31 | } 32 | } -------------------------------------------------------------------------------- /LoopProb32.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb32 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=n;j>i;j--) 19 | { 20 | System.out.print(" "); 21 | } 22 | for(k=1;k<=i;k++) 23 | { 24 | System.out.print(i+" "); 25 | } 26 | System.out.println(); 27 | } 28 | System.out.println(); 29 | } 30 | } -------------------------------------------------------------------------------- /LoopProb33.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb33 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=n;j>i;j--) 19 | { 20 | System.out.print(" "); 21 | } 22 | for(k=1;k<=i;k++) 23 | { 24 | System.out.print(k+" "); 25 | } 26 | System.out.println(); 27 | } 28 | System.out.println(); 29 | } 30 | } -------------------------------------------------------------------------------- /LoopProb05.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb05 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=n;j>i;j--) 19 | { 20 | System.out.print(" "); 21 | } 22 | for(k=1;k<=i;k++) 23 | { 24 | System.out.print("@ "); 25 | } 26 | System.out.println(); 27 | } 28 | System.out.println(); 29 | } 30 | } -------------------------------------------------------------------------------- /LoopProb89.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb89 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | int m=1,r=7; 15 | 16 | for(int i=1;i<=n;i++) 17 | { 18 | int c=r; 19 | 20 | for(int j=1;j<=m;j++) 21 | { 22 | System.out.print(c+" "); 23 | c++; 24 | } 25 | r=r*2; 26 | m=m*2; 27 | 28 | System.out.println(); 29 | } 30 | System.out.println(); 31 | } 32 | } -------------------------------------------------------------------------------- /LoopProb43.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb43 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n,c=9; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=1;j<=i;j++) 19 | { 20 | if(c==10) 21 | { 22 | c=0; 23 | } 24 | 25 | System.out.print(c+" "); 26 | c++; 27 | } 28 | System.out.println(); 29 | } 30 | System.out.println(); 31 | } 32 | } -------------------------------------------------------------------------------- /LoopProb88.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb88 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | for(int i=1;i<=n;i++) 15 | { 16 | for(int j=1;j<=n;j++) 17 | { 18 | if(i==j) 19 | { 20 | System.out.print("*"); 21 | } 22 | else 23 | { 24 | System.out.print("0"); 25 | } 26 | } 27 | 28 | System.out.println(); 29 | } 30 | System.out.println(); 31 | } 32 | } -------------------------------------------------------------------------------- /LoopProb02.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb02 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=1;j<=n;j++) 19 | { 20 | if(i>j) 21 | { 22 | System.out.print(" "); 23 | } 24 | else 25 | { 26 | System.out.print("# "); 27 | } 28 | } 29 | System.out.println(); 30 | } 31 | System.out.println(); 32 | } 33 | } -------------------------------------------------------------------------------- /LoopProb48.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb48 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n,m=1; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=n;j>i;j--) 19 | { 20 | System.out.print(" "); 21 | } 22 | for(k=1;k<=m;k++) 23 | { 24 | System.out.print(i); 25 | } 26 | System.out.println(); 27 | m=m+2; 28 | } 29 | System.out.println(); 30 | } 31 | } -------------------------------------------------------------------------------- /LoopProb50.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb50 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int c = n; 17 | 18 | for(i=1;i<=n;i++) 19 | { 20 | for(j=1;j<=i;j++) 21 | { 22 | System.out.print(c); 23 | if(c=j) 21 | { 22 | System.out.print("# "); 23 | } 24 | else 25 | { 26 | System.out.print(" "); 27 | } 28 | } 29 | System.out.println(); 30 | } 31 | System.out.println(); 32 | } 33 | } -------------------------------------------------------------------------------- /LoopProb60.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb60 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n,c=1; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=n;j>i;j--) 19 | { 20 | System.out.print(" "); 21 | } 22 | for(k=1;k<=i;k++) 23 | { 24 | System.out.print(c+" "); 25 | c++; 26 | } 27 | System.out.println(); 28 | } 29 | System.out.println(); 30 | } 31 | } -------------------------------------------------------------------------------- /LoopProb12.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb12 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | int c=1; 19 | 20 | for(j=n;j>i;j--) 21 | { 22 | System.out.print(" "); 23 | } 24 | for(k=1;k<=i;k++) 25 | { 26 | System.out.print(c+" "); 27 | c++; 28 | } 29 | System.out.println(); 30 | } 31 | System.out.println(); 32 | } 33 | } -------------------------------------------------------------------------------- /LoopProb19.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb19 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,l=1,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | int c=0; 19 | 20 | for(j=n;j>i;j--) 21 | { 22 | System.out.print(" "); 23 | } 24 | for(k=1;k<=l;k++) 25 | { 26 | System.out.print("* "); 27 | } 28 | System.out.println(); 29 | l=l+2; 30 | } 31 | System.out.println(); 32 | } 33 | } -------------------------------------------------------------------------------- /LoopProb26.java: -------------------------------------------------------------------------------- 1 | public class LoopProb26 2 | { 3 | public static void main(String[] args) 4 | { 5 | int i,j,k=0,n=5; 6 | char[] a = new char[n]; 7 | 8 | a[0]='I'; 9 | a[1]='N'; 10 | a[2]='D'; 11 | a[3]='I'; 12 | a[4]='A'; 13 | 14 | int l=2*n; 15 | 16 | System.out.println(); 17 | 18 | for(i=1;i<=l;i++) 19 | { 20 | if(i<=n) 21 | { 22 | k++; 23 | } 24 | else if(i==n+1) 25 | { 26 | k=n; 27 | } 28 | else 29 | { 30 | k--; 31 | } 32 | for(j=0;j=i;k--) 25 | { 26 | System.out.print(c+" "); 27 | c++; 28 | } 29 | System.out.println(); 30 | } 31 | System.out.println(); 32 | } 33 | } -------------------------------------------------------------------------------- /LoopProb68.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb68 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | for(int i=1;i<=n;i++) 15 | { 16 | int c = i; 17 | 18 | for(int j=1;j<=n;j++) 19 | { 20 | System.out.print(c); 21 | 22 | if(c==4) 23 | { 24 | c=1; 25 | } 26 | else 27 | { 28 | c++; 29 | } 30 | } 31 | System.out.println(); 32 | } 33 | System.out.println(); 34 | } 35 | } -------------------------------------------------------------------------------- /LoopProb72.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb72 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | int c=1; 15 | 16 | for(int i=1;i<=n;i++) 17 | { 18 | for(int j=1;j<=i;j++) 19 | { 20 | System.out.print(c+" "); 21 | 22 | if(c==9) 23 | { 24 | c=1; 25 | } 26 | else 27 | { 28 | c++; 29 | } 30 | } 31 | System.out.println(); 32 | } 33 | System.out.println(); 34 | } 35 | } -------------------------------------------------------------------------------- /LoopProb31.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb31 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | int c=n; 19 | 20 | for(j=1;j<=n;j++) 21 | { 22 | if(i>j) 23 | { 24 | System.out.print(" "); 25 | } 26 | else 27 | { 28 | System.out.print(c); 29 | } 30 | c--; 31 | } 32 | 33 | System.out.println(); 34 | } 35 | System.out.println(); 36 | } 37 | } -------------------------------------------------------------------------------- /LoopProb84.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb84 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | int c=1; 15 | 16 | for(int i=1;i<=n;i++) 17 | { 18 | int m=0; 19 | 20 | if(i%2==0) 21 | { 22 | m=2; 23 | } 24 | else 25 | { 26 | m=1; 27 | } 28 | for(int j=1;j<=m;j++) 29 | { 30 | System.out.print(c); 31 | c++; 32 | } 33 | System.out.println(); 34 | } 35 | System.out.println(); 36 | } 37 | } -------------------------------------------------------------------------------- /LoopProb30.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb30 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | int c=n; 19 | 20 | for(j=1;j<=n;j++) 21 | { 22 | if((i+j)<=n) 23 | { 24 | System.out.print(" "); 25 | } 26 | else 27 | { 28 | System.out.print(c); 29 | } 30 | c--; 31 | } 32 | 33 | System.out.println(); 34 | } 35 | System.out.println(); 36 | } 37 | } -------------------------------------------------------------------------------- /LoopProb79.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb79 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | int l=n+2; 15 | 16 | for(int i=1;i<=n;i++) 17 | { 18 | for(int j=1;j<=l;j++) 19 | { 20 | if(i==1||i==n||j==1||j==l) 21 | { 22 | System.out.print("*"); 23 | } 24 | else 25 | { 26 | System.out.print(" "); 27 | } 28 | } 29 | System.out.println(); 30 | } 31 | System.out.println(); 32 | } 33 | } -------------------------------------------------------------------------------- /LoopProb45.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb45 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n,m=1; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | int c=1; 19 | 20 | for(j=n;j>i;j--) 21 | { 22 | System.out.print(" "); 23 | } 24 | for(k=1;k<=m;k++) 25 | { 26 | System.out.print(c+" "); 27 | c++; 28 | } 29 | System.out.println(); 30 | m=m+2; 31 | } 32 | System.out.println(); 33 | } 34 | } -------------------------------------------------------------------------------- /LoopProb16.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb16 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | int c=1; 19 | 20 | for(j=1;j<=n;j++) 21 | { 22 | if(i>j) 23 | { 24 | System.out.print(" "); 25 | } 26 | else 27 | { 28 | System.out.print(c+" "); 29 | c++; 30 | } 31 | } 32 | System.out.println(); 33 | } 34 | System.out.println(); 35 | } 36 | } -------------------------------------------------------------------------------- /LoopProb25.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb25 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k=0,n,c=0; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int l=n+(n-1); 17 | 18 | for(i=1;i<=l;i++) 19 | { 20 | if(i<=n) 21 | { 22 | c++; 23 | k++; 24 | } 25 | else 26 | { 27 | c--; 28 | k--; 29 | } 30 | for(j=1;j<=k;j++) 31 | { 32 | System.out.print(c+" "); 33 | } 34 | System.out.println(); 35 | } 36 | System.out.println(); 37 | } 38 | } -------------------------------------------------------------------------------- /LoopProb63.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb63 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n,m=1; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int l = n+(n-1); 17 | 18 | for(i=1;i<=l;i++) 19 | { 20 | for(j=1;j<=m;j++) 21 | { 22 | System.out.print("*"); 23 | } 24 | 25 | if(i>=n) 26 | { 27 | m--; 28 | } 29 | else 30 | { 31 | m++; 32 | } 33 | System.out.println(); 34 | } 35 | System.out.println(); 36 | } 37 | } -------------------------------------------------------------------------------- /LoopProb27.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb27 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k=0,n; 8 | char c='@'; 9 | 10 | Scanner sc = new Scanner(System.in); 11 | 12 | System.out.print("\nEnter The Number Of Row : "); 13 | n = sc.nextInt(); 14 | 15 | System.out.println(); 16 | 17 | int l=n+(n-1); 18 | 19 | for(i=1;i<=l;i++) 20 | { 21 | if(i<=n) 22 | { 23 | c++; 24 | k++; 25 | } 26 | else 27 | { 28 | c--; 29 | k--; 30 | } 31 | for(j=1;j<=k;j++) 32 | { 33 | System.out.print(c); 34 | } 35 | System.out.println(); 36 | } 37 | System.out.println(); 38 | } 39 | } -------------------------------------------------------------------------------- /LoopProb81.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb81 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | int c=1; 15 | char a=65; 16 | 17 | for(int i=1;i<=n;i++) 18 | { 19 | for(int j=1;j<=i;j++) 20 | { 21 | if(i%2==0) 22 | { 23 | System.out.print(a+" "); 24 | a++; 25 | } 26 | else 27 | { 28 | System.out.print(c+" "); 29 | c++; 30 | } 31 | } 32 | System.out.println(); 33 | } 34 | System.out.println(); 35 | } 36 | } -------------------------------------------------------------------------------- /LoopProb64.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb64 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n,m=1; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | int c=i; 19 | 20 | for(j=1;j<=m;j++) 21 | { 22 | System.out.print(c); 23 | 24 | if(j=i;j--) 28 | { 29 | int c = 65+p; 30 | char a = (char)c; 31 | 32 | System.out.print(a); 33 | p--; 34 | } 35 | System.out.println(); 36 | } 37 | System.out.println(); 38 | } 39 | } -------------------------------------------------------------------------------- /LoopProb94.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb94 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Elements : "); 10 | int n = sc.nextInt(); 11 | 12 | int[] a= new int[n]; 13 | 14 | System.out.println("\nEnter The Elements : \n"); 15 | 16 | for(int i=0;ii;j--) 28 | { 29 | System.out.print(a[c]); 30 | c++; 31 | } 32 | System.out.println(); 33 | } 34 | System.out.println(); 35 | } 36 | } -------------------------------------------------------------------------------- /LoopProb59.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb59 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | char a = 65; 19 | int c = 1; 20 | 21 | for(j=1;j<=i;j++) 22 | { 23 | if(i%2==0) 24 | { 25 | System.out.print(a); 26 | a++; 27 | } 28 | else 29 | { 30 | System.out.print(c); 31 | c++; 32 | } 33 | } 34 | System.out.println(); 35 | } 36 | System.out.println(); 37 | } 38 | } -------------------------------------------------------------------------------- /LoopProb54.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb54 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Value Of n : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.print("\nThe Number Of Rows Are : "+n*2+"\n"); 15 | 16 | System.out.println(); 17 | 18 | for(i=1;i<=n*2;i++) 19 | { 20 | for(j=1;j<=i;j++) 21 | { 22 | if(j==1 || i==j || i==n*2) 23 | { 24 | System.out.print("*"); 25 | } 26 | else 27 | { 28 | System.out.print(" "); 29 | } 30 | } 31 | System.out.println(); 32 | } 33 | System.out.println(); 34 | } 35 | } -------------------------------------------------------------------------------- /LoopProb23.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb23 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,l=1,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | char c='@'; 19 | 20 | for(j=n;j>i;j--) 21 | { 22 | System.out.print(" "); 23 | } 24 | for(k=1;k<=l;k++) 25 | { 26 | if(k<=i) 27 | { 28 | c++; 29 | } 30 | else 31 | { 32 | c--; 33 | } 34 | System.out.print(c+" "); 35 | } 36 | System.out.println(); 37 | l=l+2; 38 | } 39 | System.out.println(); 40 | } 41 | } -------------------------------------------------------------------------------- /LoopProb38.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb38 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,m=1,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | char c='@'; 19 | 20 | for(j=n;j>i;j--) 21 | { 22 | System.out.print(" "); 23 | } 24 | for(k=1;k<=m;k++) 25 | { 26 | if(k<=i) 27 | { 28 | c++; 29 | } 30 | else 31 | { 32 | c--; 33 | } 34 | System.out.print(c); 35 | } 36 | System.out.println(); 37 | 38 | m=m+2; 39 | } 40 | System.out.println(); 41 | } 42 | } -------------------------------------------------------------------------------- /LoopProb17.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb17 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,l=1,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | int c=0; 19 | 20 | for(j=n;j>i;j--) 21 | { 22 | System.out.print(" "); 23 | } 24 | for(k=1;k<=l;k++) 25 | { 26 | if(k<=i) 27 | { 28 | c++; 29 | } 30 | else 31 | { 32 | c--; 33 | } 34 | System.out.print(c+" "); 35 | } 36 | System.out.println(); 37 | l=l+2; 38 | } 39 | System.out.println(); 40 | } 41 | } -------------------------------------------------------------------------------- /LoopProb29.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb29 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int l=n+(n-1); 17 | int c=0; 18 | 19 | for(i=1;i<=n;i++) 20 | { 21 | for(j=1;j=i;k--) 26 | { 27 | if(k>=n) 28 | { 29 | c++; 30 | } 31 | else 32 | { 33 | c--; 34 | } 35 | System.out.print(c); 36 | } 37 | System.out.println(); 38 | l--; 39 | } 40 | System.out.println(); 41 | } 42 | } -------------------------------------------------------------------------------- /LoopProb71.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb71 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | for(int i=1;i<=n;i++) 15 | { 16 | int c = i; 17 | 18 | for(int j=1;j<=n;j++) 19 | { 20 | int b=64+c; 21 | char a=(char)b; 22 | 23 | if(i<=j) 24 | { 25 | System.out.print(a); 26 | } 27 | 28 | if(c==4) 29 | { 30 | c=1; 31 | } 32 | else 33 | { 34 | c++; 35 | } 36 | } 37 | System.out.println(); 38 | } 39 | System.out.println(); 40 | } 41 | } -------------------------------------------------------------------------------- /LoopProb24.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb24 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n; 8 | char c='@'; 9 | 10 | Scanner sc = new Scanner(System.in); 11 | 12 | System.out.print("\nEnter The Number Of Row : "); 13 | n = sc.nextInt(); 14 | 15 | System.out.println(); 16 | 17 | int p=n+(n-1); 18 | 19 | for(i=1;i<=n;i++) 20 | { 21 | for(j=1;j=i;k--) 26 | { 27 | if(k>=n) 28 | { 29 | c++; 30 | } 31 | else 32 | { 33 | c--; 34 | } 35 | System.out.print(c+" "); 36 | } 37 | System.out.println(); 38 | p--; 39 | } 40 | System.out.println(); 41 | } 42 | } -------------------------------------------------------------------------------- /LoopProb49.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb49 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n,m=1,c=0; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=1;j<=m;j++) 19 | { 20 | if(i==j) 21 | { 22 | c=9; 23 | } 24 | else 25 | { 26 | c--; 27 | } 28 | if(i>2 && j>1 && i>j) 29 | { 30 | c=c+2; 31 | } 32 | 33 | System.out.print(c); 34 | } 35 | System.out.println(); 36 | m=m+2; 37 | } 38 | System.out.println(); 39 | } 40 | } -------------------------------------------------------------------------------- /LoopProb51.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb51 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n,m=1,c=0; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=1;j<=m;j++) 19 | { 20 | if(i==j) 21 | { 22 | c=5; 23 | } 24 | else 25 | { 26 | c--; 27 | } 28 | if(i>2 && j>1 && i>j) 29 | { 30 | c=c+2; 31 | } 32 | 33 | System.out.print(c); 34 | } 35 | System.out.println(); 36 | m=m+2; 37 | } 38 | System.out.println(); 39 | } 40 | } -------------------------------------------------------------------------------- /LoopProb86.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb86 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | int m=1; 15 | 16 | for(int i=1;i<=n;i++) 17 | { 18 | int c=1; 19 | 20 | for(int j=1;j<=m;j++) 21 | { 22 | if(j==1||j==m) 23 | { 24 | c=1; 25 | } 26 | else 27 | { 28 | if(j<=i) 29 | { 30 | c++; 31 | } 32 | else 33 | { 34 | c--; 35 | } 36 | } 37 | System.out.print(c); 38 | } 39 | m=m+2; 40 | System.out.println(); 41 | } 42 | System.out.println(); 43 | } 44 | } -------------------------------------------------------------------------------- /LoopProb39.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb39 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int p=n+(n-1); 17 | 18 | for(i=1;i<=n;i++) 19 | { 20 | char c='@'; 21 | 22 | for(j=1;j=i;k--) 27 | { 28 | if(k>=n) 29 | { 30 | c++; 31 | } 32 | else 33 | { 34 | c--; 35 | } 36 | System.out.print(c); 37 | } 38 | System.out.println(); 39 | p--; 40 | } 41 | System.out.println(); 42 | } 43 | } -------------------------------------------------------------------------------- /LoopProb85.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb85 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | int m=1; 15 | 16 | for(int i=1;i<=n;i++) 17 | { 18 | int c=1; 19 | 20 | for(int j=1;j<=m;j++) 21 | { 22 | if(j==1||j==m) 23 | { 24 | c=1; 25 | } 26 | else 27 | { 28 | c++; 29 | } 30 | System.out.print(c); 31 | } 32 | 33 | if(i==1) 34 | { 35 | m=m+2; 36 | } 37 | else 38 | { 39 | m++; 40 | } 41 | 42 | System.out.println(); 43 | } 44 | System.out.println(); 45 | } 46 | } -------------------------------------------------------------------------------- /LoopProb56.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb56 4 | { 5 | public static void main(String[] args) 6 | { 7 | int n,i,j,k,l,m; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=n;j>=i;j--) 19 | { 20 | System.out.print("*"); 21 | } 22 | for(k=1;k=i;m--) 31 | { 32 | System.out.print("*"); 33 | } 34 | System.out.println(); 35 | } 36 | System.out.println(); 37 | } 38 | } -------------------------------------------------------------------------------- /LoopProb18.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb18 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int p=n+(n-1); 17 | 18 | for(i=1;i<=n;i++) 19 | { 20 | int c=0; 21 | 22 | for(j=1;j=i;k--) 27 | { 28 | if(k>=n) 29 | { 30 | c++; 31 | } 32 | else 33 | { 34 | c--; 35 | } 36 | System.out.print(c+" "); 37 | } 38 | System.out.println(); 39 | p--; 40 | } 41 | System.out.println(); 42 | } 43 | } -------------------------------------------------------------------------------- /LoopProb92.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb92 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | int r=n,m=1; 15 | 16 | for(int i=1;i<=n;i++) 17 | { 18 | for(int k=n;k>i;k--) 19 | { 20 | System.out.print(" "); 21 | } 22 | 23 | int c=r; 24 | 25 | for(int j=1;j<=m;j++) 26 | { 27 | System.out.print(c); 28 | 29 | if(j=1;j--) 23 | { 24 | if(j>s) 25 | { 26 | c++; 27 | } 28 | else if(j==s) 29 | { 30 | c=s; 31 | } 32 | else if(j=1;j--) 26 | { 27 | System.out.print(c); 28 | 29 | if(j>r) 30 | { 31 | c--; 32 | } 33 | else 34 | { 35 | c++; 36 | } 37 | } 38 | 39 | l=l-2; 40 | r--; 41 | 42 | System.out.println(); 43 | } 44 | System.out.println(); 45 | } 46 | } -------------------------------------------------------------------------------- /LoopProb75.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb75 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | for(int i=1;i<=n;i++) 15 | { 16 | int c=i; 17 | for(int j=1;j<=i;j++) 18 | { 19 | System.out.print(c); 20 | c--; 21 | } 22 | 23 | for(int k=n;k>=i;k--) 24 | { 25 | System.out.print(" "); 26 | } 27 | int d=i; 28 | for(int j=1;j<=i;j++) 29 | { 30 | int z=96+d; 31 | char a=(char)z; 32 | System.out.print(a); 33 | d--; 34 | } 35 | 36 | System.out.println(); 37 | } 38 | System.out.println(); 39 | } 40 | } -------------------------------------------------------------------------------- /LoopProb77.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class LoopProb77 4 | { 5 | public static void main(String[] args) 6 | { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | System.out.print("\nEnter The Number Of Rows : "); 10 | int n = sc.nextInt(); 11 | 12 | System.out.println(); 13 | 14 | int c=1; 15 | 16 | for(int i=1;i<=n;i++) 17 | { 18 | for(int j=1;j<=i;j++) 19 | { 20 | if(i%2==0) 21 | { 22 | if(j%2==0) 23 | { 24 | c=1; 25 | } 26 | else 27 | { 28 | c=0; 29 | } 30 | } 31 | else 32 | { 33 | if(j%2==0) 34 | { 35 | c=0; 36 | } 37 | else 38 | { 39 | c=1; 40 | } 41 | } 42 | System.out.print(c); 43 | } 44 | System.out.println(); 45 | } 46 | System.out.println(); 47 | } 48 | } -------------------------------------------------------------------------------- /LoopProb47.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb47 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int s = n; 17 | 18 | for(i=1;i<=n;i++) 19 | { 20 | int c = 64; 21 | 22 | for(j=s*2;j>=1;j--) 23 | { 24 | if(j>s) 25 | { 26 | c++; 27 | } 28 | else if(j==s) 29 | { 30 | c=64+s; 31 | } 32 | else if(ji;j--) 19 | { 20 | System.out.print("#"); 21 | } 22 | 23 | System.out.print("*"); 24 | 25 | for(int k=1;ki;o--) 38 | { 39 | System.out.print("#"); 40 | } 41 | 42 | System.out.println(); 43 | } 44 | System.out.println(); 45 | } 46 | } -------------------------------------------------------------------------------- /LoopProb34.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb34 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,m=1,n,p=0; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int l=n+(n-1); 17 | 18 | for(i=1;i<=l;i++) 19 | { 20 | if(i>n) 21 | { 22 | p--; 23 | } 24 | else 25 | { 26 | p++; 27 | } 28 | for(j=n;j>p;j--) 29 | { 30 | System.out.print(" "); 31 | } 32 | for(k=1;k<=m;k++) 33 | { 34 | System.out.print("*"); 35 | } 36 | System.out.println(); 37 | 38 | if(i=i;j--) 23 | { 24 | System.out.print(c); 25 | c++; 26 | } 27 | for(k=1;k=i;m--) 36 | { 37 | System.out.print(d); 38 | d--; 39 | } 40 | System.out.println(); 41 | d = n-i; 42 | } 43 | System.out.println(); 44 | } 45 | } -------------------------------------------------------------------------------- /LoopProb40.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb40 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n,p=0,m=1; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int l=n+(n-1); 17 | 18 | for(i=1;i<=l;i++) 19 | { 20 | char c='@'; 21 | 22 | if(i>n) 23 | { 24 | p--; 25 | } 26 | else 27 | { 28 | p++; 29 | } 30 | 31 | for(j=n;j>p;j--) 32 | { 33 | System.out.print(" "); 34 | } 35 | 36 | for(k=1;k<=m;k++) 37 | { 38 | c++; 39 | System.out.print(c); 40 | } 41 | System.out.println(); 42 | 43 | if(i=i;k--) 24 | { 25 | System.out.print("*"); 26 | } 27 | 28 | System.out.print(" "); 29 | 30 | for(int l=n;l>=i;l--) 31 | { 32 | System.out.print("*"); 33 | } 34 | 35 | System.out.print(" "); 36 | 37 | for(int m=1;m<=i;m++) 38 | { 39 | System.out.print("*"); 40 | } 41 | System.out.println(); 42 | } 43 | System.out.println(); 44 | } 45 | } -------------------------------------------------------------------------------- /LoopProb21.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb21 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n,c=1; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Row : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | for(i=1;i<=n;i++) 17 | { 18 | for(j=n;j>i;j--) 19 | { 20 | System.out.print(" "); 21 | } 22 | for(k=1;k<=i;k++) 23 | { 24 | if(k==1||i==k) 25 | { 26 | c=1; 27 | } 28 | else 29 | { 30 | c=c*((i-1)-(k-1)+1)/(k-1); 31 | } 32 | if(c>9) 33 | { 34 | System.out.print(c+" "); 35 | } 36 | else 37 | { 38 | System.out.print(c+" "); 39 | } 40 | } 41 | System.out.println(); 42 | } 43 | System.out.println(); 44 | } 45 | } -------------------------------------------------------------------------------- /LoopProb62.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb62 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,n; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | char c; 17 | 18 | for(i=1;i<=n;i++) 19 | { 20 | for(j=1;j<=i;j++) 21 | { 22 | if(i%2==0) 23 | { 24 | if(j%2==0) 25 | { 26 | c='A'; 27 | } 28 | else 29 | { 30 | c='B'; 31 | } 32 | } 33 | else 34 | { 35 | if(j%2==0) 36 | { 37 | c='B'; 38 | } 39 | else 40 | { 41 | c='A'; 42 | } 43 | } 44 | System.out.print(c); 45 | } 46 | System.out.println(); 47 | } 48 | System.out.println(); 49 | } 50 | } -------------------------------------------------------------------------------- /LoopProb52.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb52 4 | { 5 | public static void main(String[] args) 6 | { 7 | int i,j,k,n,p=1; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Value Of n : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println("\nThe Number Of Rows Are : "+(n+(n-1))); 15 | 16 | System.out.println(); 17 | 18 | int l = n + (n-1); 19 | int m = l; 20 | 21 | for(i=1;i<=l;i++) 22 | { 23 | for(j=1;jn) 23 | { 24 | p--; 25 | } 26 | else 27 | { 28 | p++; 29 | } 30 | for(j=n;j>p;j--) 31 | { 32 | System.out.print(" "); 33 | } 34 | for(k=1;k<=m;k++) 35 | { 36 | int s=m/2+1; 37 | 38 | if(k<=s) 39 | { 40 | c++; 41 | } 42 | else 43 | { 44 | c--; 45 | } 46 | System.out.print(c); 47 | } 48 | System.out.println(); 49 | 50 | if(in) 23 | { 24 | p--; 25 | } 26 | else 27 | { 28 | p++; 29 | } 30 | for(j=n;j>p;j--) 31 | { 32 | System.out.print(" "); 33 | } 34 | for(k=1;k<=m;k++) 35 | { 36 | int s=m/2+1; 37 | 38 | if(k<=s) 39 | { 40 | c++; 41 | } 42 | else 43 | { 44 | c--; 45 | } 46 | System.out.print(c); 47 | } 48 | System.out.println(); 49 | 50 | if(in) 30 | { 31 | p--; 32 | } 33 | else 34 | { 35 | p++; 36 | } 37 | 38 | for(j=n;j>p;j--) 39 | { 40 | System.out.print(" "); 41 | } 42 | 43 | for(k=1;k<=m;k++) 44 | { 45 | int s=m/2+1; 46 | 47 | System.out.print(c); 48 | 49 | if(k=m;j--) 25 | { 26 | System.out.print(c); 27 | c++; 28 | } 29 | 30 | for(int k=1;k=p;q--) 43 | { 44 | if(i==1 || i==2 || i==l-1 || i==l) 45 | { 46 | System.out.print(q); 47 | } 48 | else 49 | { 50 | System.out.print(a); 51 | a--; 52 | } 53 | } 54 | 55 | if(i>=2 && i=n) 101 | { 102 | o--; 103 | } 104 | else 105 | { 106 | o++; 107 | } 108 | 109 | System.out.println(); 110 | } 111 | System.out.println(); 112 | } 113 | } -------------------------------------------------------------------------------- /LoopProb66.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class LoopProb66 4 | { 5 | public static void main(String[] args) 6 | { 7 | int m=1,n,o=1,p=1; 8 | 9 | Scanner sc = new Scanner(System.in); 10 | 11 | System.out.print("\nEnter The Number Of Rows : "); 12 | n = sc.nextInt(); 13 | 14 | System.out.println(); 15 | 16 | int l=n+(n-1); 17 | int z=n-1; 18 | int r=z-1; 19 | 20 | for(int i=1;i<=l;i++) 21 | { 22 | int c = 65; 23 | 24 | for(int j=n;j>=m;j--) 25 | { 26 | char g=(char)c; 27 | System.out.print(g); 28 | c++; 29 | } 30 | 31 | for(int k=1;k=p;q--) 44 | { 45 | if(i==1 || i==2 || i==l-1 || i==l) 46 | { 47 | int y=64+q; 48 | char t =(char)y; 49 | System.out.print(t); 50 | } 51 | else 52 | { 53 | int f=64+a; 54 | char w=(char)f; 55 | System.out.print(w); 56 | a--; 57 | } 58 | } 59 | 60 | if(i>=2 && i=n) 106 | { 107 | o--; 108 | } 109 | else 110 | { 111 | o++; 112 | } 113 | 114 | System.out.println(); 115 | } 116 | System.out.println(); 117 | } 118 | } -------------------------------------------------------------------------------- /Pyramid.txt: -------------------------------------------------------------------------------- 1 | Q.1 Write a program to generate a following structure: 2 | @@@@@ 3 | @@@@@ 4 | @@@@@ 5 | @@@@@ 6 | @@@@@ 7 | 8 | Q.2 Write a program to generate a following #'s triangle: 9 | # # # # # 10 | # # # # 11 | # # # 12 | # # 13 | # 14 | 15 | Q.3 Write a program to generate a following @'s triangle: 16 | @ @ @ @ @ 17 | @ @ @ @ 18 | @ @ @ 19 | @ @ 20 | @ 21 | 22 | Q.4 Write a program to generate a following #'s triangle:- 23 | # 24 | # # 25 | # # # 26 | # # # # 27 | # # # # # 28 | 29 | 30 | Q.5 Write a program to generate a following @'s triangle: 31 | @ 32 | @ @ 33 | @ @ @ 34 | @ @ @ @ 35 | @ @ @ @ @ 36 | 37 | Q.6 Write a program to generate a following numbers structure: 38 | 12345 39 | 12345 40 | 12345 41 | 12345 42 | 12345 43 | 44 | Q.7 Write a program to generate a following numbers structure: 45 | 54321 46 | 54321 47 | 54321 48 | 54321 49 | 54321 50 | 51 | Q.8 Write a program to generate a following numbers structure: 52 | 55555 53 | 44444 54 | 33333 55 | 22222 56 | 11111 57 | 58 | Q.9 Write a program to generate a following numbers structure: 59 | 11111 60 | 22222 61 | 33333 62 | 44444 63 | 55555 64 | 65 | Q.10 Write a program to generate a following numbers structure: 66 | 1 67 | 12 68 | 123 69 | 1234 70 | 12345 71 | 72 | Q.11 Write a program to generate a following numbers structure: 73 | 12345 74 | 1234 75 | 123 76 | 12 77 | 1 78 | 79 | Q.12 Write a program to generate a following numbers structure: 80 | 1 81 | 1 2 82 | 1 2 3 83 | 1 2 3 4 84 | 1 2 3 4 5 85 | 86 | Q.13 Write a program to generate a following numbers structure: 87 | 54321 88 | 4321 89 | 321 90 | 21 91 | 1 92 | 93 | Q.14 Write a program to generate a following numbers structure: 94 | 1 95 | 21 96 | 321 97 | 4321 98 | 54321 99 | 100 | Q.15 Write a program to generate a following numbers structure: 101 | 12345 102 | 1234 103 | 123 104 | 12 105 | 1 106 | 107 | Q.16 Write a program to generate a following numbers structure: 108 | 1 2 3 4 5 109 | 1 2 3 4 110 | 1 2 3 111 | 1 2 112 | 1 113 | 114 | Q.17 Write a program to generate a following numbers structure: 115 | 1 116 | 1 2 1 117 | 1 2 3 2 1 118 | 1 2 3 4 3 2 1 119 | 1 2 3 4 5 4 3 2 1 120 | 121 | Q.18 Write a program to generate a following numbers structure: 122 | 1 2 3 4 5 4 3 2 1 123 | 1 2 3 4 3 2 1 124 | 1 2 3 2 1 125 | 1 2 1 126 | 1 127 | 128 | 129 | Q.19 Write a C program to print the following triangle: 130 | 131 | * 132 | * * * 133 | * * * * * 134 | * * * * * * * 135 | * * * * * * * * * 136 | * * * * * * * * * * * 137 | 138 | Q.20 Write a C program to print Floyd's triangle: 139 | 1 140 | 2 3 141 | 4 5 6 142 | 7 8 9 10 143 | 144 | Q.21 Write a C program to print Pascal triangle: 145 | 1 146 | 1 1 147 | 1 2 1 148 | 1 3 3 1 149 | 150 | Q.22 Write a C program to print following character triangle: 151 | A 152 | B B 153 | C C C 154 | D D D D 155 | 156 | Q.23 Write a C program to print following character triangle: 157 | A 158 | A B A 159 | A B C B A 160 | A B C D C B A 161 | A B C D E D C B A 162 | 163 | Q.24 Write a C program to print following character triangle: 164 | A B C D E D C B A 165 | B C D E D C B 166 | C D E D C 167 | D E D 168 | E 169 | 170 | Q.25 Write a c program for following number structure: 171 | 172 | 1 173 | 2 2 174 | 3 3 3 175 | 4 4 4 4 176 | 5 5 5 5 5 177 | 4 4 4 4 178 | 3 3 3 179 | 2 2 180 | 1 181 | 182 | 183 | Q.26 Write a C program to display the string "INDIA" in following fashion: 184 | 185 | 186 | I 187 | IN 188 | IND 189 | INDI 190 | INDIA 191 | INDIA 192 | INDI 193 | IND 194 | IN 195 | I 196 | 197 | 198 | Q.27 Write a C program to display the following character structure: 199 | 200 | A 201 | BB 202 | CCC 203 | DDDD 204 | CCC 205 | BB 206 | A 207 | 208 | Q.28 Write a C program to display the following number triangle: 209 | 210 | 1 211 | 2 2 212 | 3 3 3 213 | 4 4 4 4 214 | 5 5 5 5 5 215 | 216 | Q. 29 Write a C program display the following number structure: 217 | 218 | 123454321 219 | 2345432 220 | 34543 221 | 454 222 | 5 223 | 224 | 225 | Q.30. Write a C program to display the following number triangle structure:- 226 | 227 | 1 228 | 21 229 | 321 230 | 4321 231 | 54321 232 | 233 | Q.31. Write a C program to display the following number triangle structure: 234 | 235 | 54321 236 | 4321 237 | 321 238 | 21 239 | 1 240 | Q.32 Write a C program to print the following number pyramid: 241 | 242 | 243 | 1 244 | 2 2 245 | 3 3 3 246 | 4 4 4 4 247 | 5 5 5 5 5 248 | 6 6 6 6 6 6 249 | 250 | 251 | 252 | Q.33 Write a C program to print the following number structure: 253 | 254 | 255 | 1 256 | 1 2 257 | 1 2 3 258 | 1 2 3 4 259 | 1 2 3 4 5 260 | 1 2 3 4 5 6 261 | 262 | 263 | Q. 34 Write a C program to display the following rhombus symbol structure: 264 | 265 | * 266 | *** 267 | ***** 268 | ******* 269 | ***** 270 | *** 271 | * 272 | 273 | Q. 35 Write a C program to display the following number rhombus structure: 274 | 275 | 1 276 | 212 277 | 32123 278 | 4321234 279 | 32123 280 | 212 281 | 1 282 | 283 | Q. 36 Write a C program to display the following number rhombus structure: 284 | 285 | 1 286 | 121 287 | 12321 288 | 1234321 289 | 12321 290 | 121 291 | 1 292 | 293 | Q.37 Write a C program to display the following character rhombus structure: 294 | 295 | A 296 | ABA 297 | ABCBA 298 | ABCDCBA 299 | ABCBA 300 | ABA 301 | A 302 | 303 | Q.38 Write a C program to display the following square character triangle: 304 | 305 | A 306 | ABA 307 | ABCBA 308 | ABCDCBA 309 | 310 | Q.39 Write a C program to display the following square character triangle: 311 | 312 | ABCDCBA 313 | ABCBA 314 | ABA 315 | A 316 | 317 | 318 | Q.40 Write a C program to display the following square character triangle: 319 | 320 | A 321 | AB 322 | ABC 323 | ABCD 324 | ABCDE 325 | ABCD 326 | ABC 327 | AB 328 | A 329 | 330 | Q.41 Write a C program to display the following square character triangle: 331 | 332 | 333 | A 334 | BA 335 | CBA 336 | DCBA 337 | EDCBA 338 | DCBA 339 | CBA 340 | BA 341 | A 342 | 343 | Q.42 Write a C program to print the following character triangle: 344 | 345 | 346 | EDCBA 347 | DCBA 348 | CBA 349 | BA 350 | A 351 | 352 | Q.43 Write a C program to print the following number design/triangle: 353 | 354 | 9 355 | 0 1 356 | 2 3 4 357 | 5 6 7 8 358 | 9 0 1 2 3 359 | 360 | Q. 44 Write a C program to print the following number rectangle: 361 | 362 | 12344321 363 | 123__321 364 | 12____21 365 | 1______1 366 | 367 | Q. 45 Write a C program to print the following number pyramid or number structure: 368 | 369 | 1 370 | 1 2 3 371 | 1 2 3 4 5 372 | 1 2 3 4 5 6 7 373 | 1 2 3 4 5 6 7 8 9 374 | 375 | Q. 46 Write a C program for print the following number pyramid: 376 | 377 | 123456654321 378 | 1234554321 379 | 12344321 380 | 123321 381 | 1221 382 | 11 383 | 384 | Q. 47 Write a C program for print the following character pyramid: 385 | 386 | ABCDEFFEDCBA 387 | ABCDEEDCBA 388 | ABCDDCBA 389 | ABCCBA 390 | ABBA 391 | AA 392 | 393 | Q. 48 Write a C program to print the following number pyramid: 394 | 395 | 1 396 | 222 397 | 33333 398 | 4444444 399 | 555555555 400 | 401 | Q. 49 Write a C program to print the following number triangle: 402 | 403 | 9 404 | 898 405 | 78987 406 | 6789876 407 | 408 | 409 | Q. 50 Write a C program to print the following number triangle: 410 | 411 | 5 412 | 45 413 | 345 414 | 2345 415 | 12345 416 | 417 | 418 | 419 | Q. 51 Write a C program to print the following number triangle: 420 | 421 | 422 | 5 423 | 454 424 | 34543 425 | 2345432 426 | 123454321 427 | 428 | Q. 52 Write a C program to print the following star structure/fashion: 429 | 430 | ********* 431 | ******* 432 | ***** 433 | *** 434 | * 435 | *** 436 | ***** 437 | ******* 438 | ********* 439 | 440 | Q. 53 Write a C program to print the following rectangle number pyramid: 441 | 442 | 33333 443 | 32223 444 | 32123 445 | 32223 446 | 33333 447 | 448 | Q. 54 Write a C program to print the star triangle frame pyramid like as: 449 | 450 | * 451 | ** 452 | * * 453 | * * 454 | * * 455 | * * 456 | * * 457 | * * 458 | * * 459 | ********** 460 | 461 | Q. 55 Write a C program to print the following star pattern pyramid: 462 | 463 | * 464 | *** 465 | ****** 466 | 467 | Q. 56 Write a C program to display the reverse star pyramid as: 468 | 469 | ********** 470 | **** **** 471 | *** *** 472 | ** ** 473 | * * 474 | 475 | Q. 57 Write a C program to display odd number series pyramid as: 476 | 477 | 1 478 | 3 5 7 479 | 9 11 13 15 17 19 480 | 481 | Q.58 Write a C program to print the following number pyramid/triangle: 482 | 483 | 54321 484 | 5432 485 | 543 486 | 54 487 | 5 488 | 489 | Q.59 Write a C program to print the number character pyramid as: 490 | 491 | 1 492 | AB 493 | 123 494 | ABCD 495 | 12345 496 | 497 | Q. 60 Write a C program to print the following Floyd triangle as: 498 | 499 | 1 500 | 2 3 501 | 4 5 6 502 | 7 8 9 10 503 | 504 | Q.61 Write a C program to print the following number pyramid: 505 | 506 | 1 2 3 4 5 507 | 2 3 4 5 508 | 3 4 5 509 | 4 5 510 | 5 511 | 512 | Q.62 Write a C program to print the following character pyramid: 513 | 514 | A 515 | BA 516 | ABA 517 | BABA 518 | ABABA 519 | 520 | Q.63 Write a C program to accept the number of rows of pyramid and print the star pyramid as:if entered number by user is 7 then output would be: 521 | 522 | * 523 | ** 524 | *** 525 | **** 526 | *** 527 | ** 528 | * 529 | 530 | Q.64 Write a C program to print the following number pyramid: 531 | 532 | 1 533 | 232 534 | 34543 535 | 4567654 536 | 537 | Q.65 Write a C program to print the following number rectangle structure: 538 | 539 | 12321 540 | 12 21 541 | 1 1 542 | 12 21 543 | 12321 544 | 545 | Q.66 Write a C program to print the following character rectangle design: 546 | 547 | ABCBA 548 | AB BA 549 | A A 550 | AB BA 551 | ABCBA 552 | 553 | Q.67 Write a C program to print the following star triangle structure: 554 | 555 | ********* 556 | ******* 557 | ***** 558 | *** 559 | * 560 | 561 | Q.68 Write a C program to print the following number rectangle program: 562 | 563 | 1234 564 | 2341 565 | 3412 566 | 4123 567 | 568 | Q.69 Write a C program to print the following character rectangle program: 569 | 570 | ABCD 571 | BCDA 572 | CDAB 573 | DABC 574 | 575 | Q.70 Write a C program to print the following number pyramid program: 576 | 577 | 1234 578 | 341 579 | 12 580 | 3 581 | 582 | Q.71 Write a C program to print the following character pyramid program: 583 | 584 | ABCD 585 | CDA 586 | AB 587 | C 588 | 589 | Q.72 Write a C program to print the following number pyramid using function: 590 | 591 | 1 592 | 2 3 593 | 4 5 6 594 | 7 8 9 1 595 | 2 3 4 5 6 596 | 597 | Q.73 Write a C program to print the following number pyramid: 598 | 599 | 1 600 | 123 601 | 12345 602 | 1234567 603 | 604 | Q.74 Write a C program to print the following number pyramid: 605 | 606 | 1333 607 | 2222 608 | 3331 609 | 610 | Q.75 Write a C program to print number character pyramid as: 611 | 612 | 1 a 613 | 21 ba 614 | 321 cba 615 | 4321 dcba 616 | 54321 edcba 617 | 618 | Q.76 Write a C program to print 0 and 1 number triangle as: 619 | 620 | 1 621 | 01 622 | 010 623 | 1010 624 | 10101 625 | 626 | Q.77 Write the 1 and 0 number pyramid program as: 627 | 628 | 1 629 | 01 630 | 101 631 | 0101 632 | 10101 633 | 634 | Q.78 Print Square star pyramid as: 635 | 636 | ***** 637 | * * 638 | * * 639 | ***** 640 | 641 | Q.79 Print Rectangle star pyramid as: 642 | 643 | ****** 644 | * * 645 | * * 646 | ****** 647 | 648 | Q.80 Even-odd number star pyramid as: 649 | 650 | 1 651 | *2 652 | 1*3 653 | *2*4 654 | 1*3*5 655 | 656 | Q.81 Print continue character number pyramid as: 657 | 658 | 1 659 | A B 660 | 2 3 4 661 | C D E F 662 | 5 6 7 8 9 663 | 664 | Q.82 Print below nested star pyramid as: 665 | 666 | * *** *** * 667 | ** ** ** ** 668 | *** * * *** 669 | 670 | Q.83 Print any random number pyramid as: 671 | 672 | 4572 673 | 572 674 | 72 675 | 2 676 | 677 | Q.84 Print the following number design: 678 | 679 | 1 680 | 23 681 | 4 682 | 56 683 | 7 684 | 89 685 | 10 686 | 687 | Q.85 Design the following number pyramid: 688 | 689 | 1 690 | 121 691 | 1231 692 | 12341 693 | 123451 694 | 695 | Q.86 Design the following continues number pyramid: 696 | 697 | 1 698 | 121 699 | 12321 700 | 1234321 701 | 123454321 702 | 703 | Q.87 Print following alternative number-star pyramid as: 704 | 705 | 1 706 | 2*2 707 | 3*3*3 708 | 4*4*4*4 709 | 4*4*4*4 710 | 3*3*3 711 | 2*2 712 | 1 713 | 714 | Q.88 print diagonal star-zero pyramid as: 715 | 716 | *000000 717 | 0*00000 718 | 00*0000 719 | 000*000 720 | 0000*00 721 | 00000*0 722 | 000000* 723 | 724 | Q.89 Any number geometric sequence number pyramid as: 725 | 726 | 7 727 | 14 15 728 | 28 29 30 31 729 | 56 57 58 59 60 61 62 63 730 | 731 | Q.90 Print the nested hash-star pyramid as: 732 | 733 | #####*##### 734 | ####*#*#### 735 | ###*###*### 736 | ##*#####*## 737 | #*#######*# 738 | *#########* 739 | 740 | Q.91 Print half-square number triangle as: 741 | 742 | 543212345 743 | 4321234 744 | 32123 745 | 212 746 | 1 747 | 748 | Q.92 Print equilateral triangle number as: 749 | 750 | 5 751 | 454 752 | 34543 753 | 2345432 754 | 123454321 755 | 756 | Q.93 Print positive-negative number triangle as: 757 | 758 | 9 759 | 8 6 760 | 7 5 3 761 | 4 2 0 -2 762 | 1 -1 -3 -5 -7 763 | --------------------------------------------------------------------------------