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');




}
}

Edited 3 Years Ago by Reverend Jim: Fixed formatting

im a newbie in programming,,i cant understand those kind of coding,,can you please solve my problem if you know?

The request to use code tags has nothing to do with programming ability; code tags are required because all spacing/formatting is stripped out when you do not use them. Your code is unreadable without them, and more important, your asterisk patterns are unreadable because all spaces are stripped without code tags.

[code]
paste code or pattern here
[/code]

Note the difference (with code tags):

[code]
*
*
*
*
[/code]

Without code tags:

*
*
*
*

Please repost using code tags, as explained above. Again, do this to retain spacing. Thanks.

Edited 3 Years Ago by happygeek: fixed formatting

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 haelp 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');




}
}

end quote.

i mean the real output put must be
if even:

    *
  ****
******

if odd:

******
 ****
    *

so now,,give me the code,,how to make that

Edited 3 Years Ago by mike_2000_17: Fixed formatting

i mean the real output put must be
if even:
*
****
******

if odd:
******
****
*

so now,,give me the code,,how to make that

i mean half diamond,,not a right triangle

import java.io.*;


public class p
{
public static void main(String[]args)throws IOException
{
 
   BufferedReader IN = new BufferedReader(new 

InputStreamReader(System.in));
   int a, c, d,cnt; 
   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=1;a<=d;a++)
               {
                 if(a==1)
                  cnt=1;
                 else
                  cnt=a*2;
                 for(c=1;c<=cnt;c++)
                    {
                      System.out.print(f);
                    }
               System.out.println(" ");
           }
       }
    else
        {
         for(a=d;a>=1;a--)
             {
                 if(a==1)
                  cnt=1;
                 else
                  cnt=a*2;
               for(c=1;c<=cnt;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');
  }
}

i want a quick solution man

I want a million dollars. The answer is no. We don't give out free code to people who make absolutely no effort.

I want a million dollars. The answer is no. We don't give out free code to people who make absolutely no effort.

what effor1 do you want for me??,,im 1 week trying for two projects,,this java is killing me

what effor1 do you want for me??,,im 1 week trying for two projects,,this java is killing me

Read my post 5 again. I told you exactly why you needed to use code tags around your diamond pattern and exactly how to do it. No one can make an sense of your diamond pattern if you don't use code tags because ALL SPACING IS STRIPPED OUT OF A POST THAT DOES NOT USE CODE TAGS!

Any pattern and any code needs to be in code tags for this reason. You refused to accommodate or even acknowledge this very simple request, plus you have a sense of entitlement that is very offputting. Hence your lack of effort. If you had used code tags, sentences like this would be unnecessary:

i mean half diamond,,not a right triangle

because the spacing would not be stripped out.

so now,,give me the code,,how to make that

We don't just give out the code if we can help it. We give hints, we try to help. We don't do the whole thing for you and post the finished product. And have you ever heard of the word "please"?

This article has been dead for over six months. Start a new discussion instead.