Saturday 6 February 2010

Draw the image of the following RHOMBUS


import java.util.Scanner;
public class rhombus{
public static void main(String []args){
int x, y, z, s, j, m, k, hhh, fff, count2= 0, ty = 0, sut = 0 ;
int count=0;
Scanner input = new Scanner( System.in );
System.out.print("Enter the size of the Rhombus");
x = input.nextInt();
hhh = x-1;
j =x;
sut = x;
fff= x + (++sut);
m = x-1;
k = m + 1;
while(x>0){
y=x;
while(y>1){
System.out.print(" ");
y--;
}
count = count + 2;
z = 6 - count;
while(z<5){
System.out.print("*");
z++;
}
System.out.println(" ");
x--;
}
while(hhh>0){
k = k+1;
y = k ;
while(y>j){
System.out.print(" ");
y--;
}
count2 = count2 - 2;
int d = fff + count2;

int jh= 2;
while(jh System.out.print("*");
jh++;
}
System.out.println(" ");
hhh--;
}
}
}

No comments:

Post a Comment