Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 15:58

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Need some helping hands here !!!

Discussion on Need some helping hands here !!! within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2009
Posts: 12
Received Thanks: 0
Need some helping hands here !!!

What is the source code for this output in JAVA Language?

Sample output:

Enter a Number:
5

*
**
***
****
*****
****
***
**
*

it should be like this. don't know how to do it. Sorry i'm just studying this for school purpose and badly need this.

this is my source code:

import java.io.*;
public class lopezKrizar_Triangle{
public static void main (String[]args)throws IOException{
DataInputStream kriz=new DataInputStream (System.in);
int ctr;
int ctr2;
int num;


System.out.print ("Enter a Number: ");
num=Integer.parseInt (kriz.readLine());

for (ctr=0;ctr<=num;ctr++)
{
System.out.println();
for (ctr2=0;ctr2<ctr;ctr2++)
{
System.out.print("*");
}


}


}
}

and this is only the output of mine

Enter a number:5
*
**
***
****
*****

help !
zepolzirk is offline  
Old 09/26/2011, 13:26   #2
Administrator
 
Muddy Waters's Avatar
 
elite*gold: 41364
Join Date: Jan 2010
Posts: 22,727
Received Thanks: 12,653
I'm not really into Java, but since it's all just some simple loops, this should do the trick:
Code:
for(int i = 0; i <= 2*num - 1; i++)
{
	System.out.println();
	for(int j = 0; j < i; j++)
	{
        	System.out.print("*");

        	if(j >= 2*num - 1 - i)
			break;
	}
}
Muddy Waters is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Helping Topic] 24/7 Helping Services!
08/27/2008 - EO PServer Hosting - 31 Replies
stucked on anything while setuping your server? post your problem here and you will get answer as fast as possible better than spamming with posts :cool: first of all try reading Ahmedpotop's Pserver All thing guide. if your couldn't solve it out post your problem down here ""That includes PHP rankings pages / registrations pages / Status pages""
Hands on :] Buy everything ANYWHERE!
01/08/2007 - Lin2 Exploits, Hacks, Bots, Tools & Macros - 47 Replies
Admin Note: This seems to work on only official servers for the most part as L2extreme people can get it working Ok this is an exploit I have found and am currentily modifying it for C4. Basicaily all you have to do to get this working is backup the file called help.html located in your lineage II&#092;l2text folder and replace it with the one I have supplyed. Then when in Lineage II find an NPC you can talk to and select them. Next open your main menu and click Help. Now all you have...
both hands
09/28/2006 - WoW Private Server - 1 Replies
Hello is it possible to learn that i can use 2 swords bzw 2 daggers? i read all threads i could find but i couldn't find the spell ID for this. can anyone help me? iam using Mangos 2297 + ScriptDev 127 with "sdb_0.4.24_2226 20060916 1046.sql" an every thing works fine.. only this litle spell sad.gif plz help
Glowing Hands
07/19/2006 - WoW Exploits, Hacks, Tools & Macros - 15 Replies
Im not sure if this has already been posted,and if it has pls excuse me. I used to do this all the time at lower levil(you need to be at least levil 35 to do this).First you well need a Cold Basilisk Eye. http://www.thottbot.com/?i=3836 You can usualy get them for cheap from the AH. Then find a easy mob to kill, right before the mob is about to die pop the trinket. If done correctley and the mob the should die without the trinkets effect working. Now your hands should be stuck glowing blue...



All times are GMT +1. The time now is 15:59.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.