•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 373,577 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,807 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
.,'this program will simply creates a diamond using asterisk.,'
just try out this code i am sure you will be interested.!..
email me about your comment in this simple program!..help me if you know the easiest way to construct this kind of program..'
just try out this code i am sure you will be interested.!..
email me about your comment in this simple program!..help me if you know the easiest way to construct this kind of program..'
import javax.swing.*; public class alpe_diamond_program { public static void main(String []args) { getri(); } public static void getri() { int x,y,z; int a=1; String out="\n"; int i=Integer.parseInt(JOptionPane.showInputDialog("Enter the size!")); if((i%2)!=0) { int in=(i/2)+(i%2); int bb=in-1; int b=bb+(bb-1); for(x=in;x>0;x--) { for(y=x;y>1;y--) out+=" "; for(z=0;z<a;z++) out+="*"; a+=2; out+="\n"; } for(x=0;x<in-1;x++) { for(y=x;y>=0;y--) out+=" "; for(z=0;z<b;z++) out+="*"; b-=2; out+="\n"; } System.out.print(out); getri();} else { System.out.print("I can't process!"); getri(); } } } //email me about your comment in this code!!!jalpex91@gmail.com
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)