__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
Input a number and if it is odd then make it even.
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
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):
*
*
*
*
Without code tags:
*
*
*
*
Please repost using code tags, as explained above. Again, do this to retain spacing. Thanks.
[code]
// paste code or pattern here
[/code]
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
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');
}
}
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
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.
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
i want a quick solution man
Then you'd better get crackin'!
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
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"?
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711