Pattern 26

Pattern 26
  • C Code
  • C++ Code
  • Java Code
  • Get these codes on your Android Device

C Code


        1
      1 2 1
    1 2 3 2 1
  1 2 3 4 3 2 1 
#include<stdio.h> #include<conio.h> #include<math.h> void main() { int n=4; //size int z=1; int i,j,k; clrscr(); for(i=1;i<=n;i++){ for(j=n-1;j>=i;j--) { printf(" "); } for(k=i-1;k>=-(i-1);k--) { printf("%d",i-abs(k)); } z+=2; printf("\n"); } getch(); }

C++ Code


        1
      1 2 1
    1 2 3 2 1
  1 2 3 4 3 2 1 
#include<iostream.h> #include<conio.h> #include<math.h> void main() { int z=1; clrscr(); for(int i=1;i<=4;i++){ for(int j=3;j>=i;j--) { cout<<" "; } for(int k=i-1;k>=-(i-1);k--) { cout<<i-abs(k); } z+=2; cout<<endl; } getch(); }

Java Code


        1
      1 2 1
    1 2 3 2 1
  1 2 3 4 3 2 1 
class Pattern_26 { public static void main(String args[]) { int z=1; int n=4; //size for(int i=1;i<=n;i++){ for(int j=n-1;j>=i;j--) { System.out.print(" "); } for(int k=i-1;k>=-(i-1);k--) { System.out.print(i-Math.abs(k)); } z+=2; System.out.println(); } } //end of main } //end of class

Android Apps


Get pattern printing codes on your Android Device :

# C Pattern Programs Free App
# C++ Pattern Programs Free App
# Java Pattern Programs Free App


Get Them Now !!!

Download Code           More Patterns !!!