Sponsered Links
Categories
Sponsered Links

write a program in swing to print diamond

write a program in swing to print diamond.

class pyramid {
    public static void main(String[] args) {
        int i,j,r=1;
        for(int k=1;k<=6;k++){
            System.out.print(k);
        }
        System.out.print("\n");
        for(i=5;i>=1;i--) {
            System.out.print(i);
            for(j=i-r;j>=1;j--)
                System.out.print(j);
                System.out.print("\n");
        }
    }
}

Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved