Print Diamond Number Pattern Program Type 3

4 comments on “Print Diamond Number Pattern Program Type 3”


  • Thilagavathi

    public class pattern {
    public static int reverse(int a) {
    int rev=0;
    while(a!=0) {
    rev=rev+(a%10);
    rev=rev*10;
    a=a/10;

    }
    return(rev/10);
    }

    public static void main(String[] args) {
    int n=4;
    int count=3;

    for(int i=1;i0;j–) {
    System.out.print(count);
    count++;
    }

    System.out.println();
    }
    count=count-n-1;

    for(int i=n-1;i>=1;i–) {
    int sum=0;
    for(int j=i;j>0;j–) {
    sum=sum+count;
    sum=sum*10;
    count–;
    }
    System.out.print (reverse(sum));
    System.out.println();
    }
    }
    }


  • Pavan

    @……….pavan
    public static void main(String[] args) {

    int sum=2,x=0;
    int n=4;

    for(int i=1;i<=n;i++){

    int count=sum+i;
    sum=count;
    for(int j=0;j<i;j++){
    System.out.print(count– +" ");
    x=count;
    }
    System.out.println();
    }
    for(int i=0;i0;j–){
    System.out.print(x– +” “);
    }
    System.out.println();
    }

    }


  • sriramulu

    class Main{
    public static void main(String[] args) {
    int count=3,num=8;
    for(int i=1;i<=4;i++){
    for(int j=1;j<=i;j++){
    System.out.print(count);
    count+=1;
    }

    System.out.println();
    }
    for(int i=1;i=i;j–){
    System.out.print(num);
    num-=1;
    }

    System.out.println();
    }
    }
    }