View Full Version : displayin name
ishandoshi
06-22-2006, 06:18 AM
Hii friends!
Had a query in java...how do i write a program that displays a name in my desktop...?
Also,How do i generate the following output using java?
1
1 2
1 2 3
Waitin for ur replies...
Thnx!
Melon00
06-22-2006, 05:05 PM
I am not sure what you mean by your first question "in my desktop..."
As for the second, not sure about java syntax, but here it is in C/C++
// iterate through rows
for (int i = 1; i <= 3; i++)
{
// iterate through columns
for(int j=0; j<i; j++)
printf("%d ", j);
putchar('\n');
}
Melon00
06-29-2006, 11:21 PM
sorry, that printf statment should look like this:
printf("%d ", i);
Aradon
06-29-2006, 11:32 PM
I am not sure what you mean by your first question "in my desktop..."
As for the second, not sure about java syntax, but here it is in C/C++
// iterate through rows
for (int i = 1; i <= 3; i++)
{
// iterate through columns
for(int j=0; j<=i; j++)
printf("%d ", j);
putchar('\n');
}
Meh, close to that.
for(int i = 1; i <=3; i++)
{
for(int j=1; j<i; j++)
System.out.print(j + " ");
System.out.println();
}
Or to be a smart arse
System.out.println("1");
System.out.println("1 2");
System.out.println("1 2 3");
:P
rpgfan3233
06-30-2006, 05:48 AM
Or if you wanted to abuse the new line escape character (though it does save keystrokes):
System.out.println("1\n1 2\n1 2 3");
Can you provide more details regarding what you mean by saying "how do i write a program that displays a name in my desktop...?"
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.