Pattern 25

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

C Code


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

C++ Code


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

Java Code


        0
      1 0 1
    2 1 0 1 2
  3 2 1 0 1 2 3
4 3 2 1 0 1 2 3 4 
class Pattern_25 { public static void main(String args[]) { int n=5; //size int z=1,l=1; for(int i=0;i<n;i++){ for(int j=n-1;j>i;j--) { System.out.print(" "); } for(int k=1;k<=z;k++) { System.out.print(Math.abs(k-l)); } l++; 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 !!!