hi im having problem on how to make the output of my programme like this:
if you enter a number: (EVEN)
*
**
***
*****
If you enter a number:(ODD)
*****
****
***
**
*
im always having an output of:
(EVEN)
*
**
***
****
(ODD)
*****
****
***
**
*
I hope somebody will help me:
here is my code:
import java.io.*;
public class del
{
public static void main(String[]args)throws IOException
{
BufferedReader IN = new BufferedReader(new InputStreamReader(System.in));
int a, c, d;
String b, e, f;
do{
System.out.println("Enter name:");
f = IN.readLine();
System.out.println("Enter a number:");
b = IN.readLine();
d = Integer.parseInt(b);
if(d%2==0)
{
for(a=d;a>=0;a--)
{
for(c=a;c<d;c++)
{
System.out.print(f);
}
System.out.println(" ");
}
}
else
{
for(a=0;a<=d;a+=1)
{
for(c=a;c<d;c++)
{
System.out.print(f);
}
System.out.println(" ");
}
}
System.out.print("Try Again?:");
e = IN.readLine();
}while(e.charAt(0)=='y'||e.charAt(0)=='Y');
}
}