Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Need help to write this program in java?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 01-12-2010
Member
 
Join Date: Apr 2010
Posts: 1
Need help to write this program in java?
  

-hi
-I recently started learning java language. Yesterday our sir has given us assignment in which there is a program like write java program to show using star and "-" is space
- ----- *
- ----**
- ---***
- --****
- *****
- and
---------*
--------***
-------*****
------*******
-----*********
------*******
-------*****
--------***
---------*


Last edited by frkadeel : 01-12-2010 at 12:17 AM.
Reply With Quote
  #2  
Old 01-12-2010
Member
 
Join Date: Dec 2007
Posts: 2,256
Re: Need help to write this program in java?

I will write a java program for CROSS STARS pattern using NESTED LOOP, which you can refer below:

for (int i = 1; i < 10; i++) {
for (int j = 1; j < 10; j++) {
if ( i == j || ( i+j == 10 )) {
System.out.printf("*");
} else {
System.out.printf("");
}
}
System.out.println();
}

replace 10 with the user input for number of stars
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Need help to write this program in java?"
Thread Thread Starter Forum Replies Last Post
How to write program to generate a pascal triangle in java? Aandaleeb Software Development 7 11-09-2011 12:37 PM
How to write java program to print pyramid of stars? Nadiaa Software Development 6 19-08-2011 05:03 PM
How to write string data to file using java program? Linoo Software Development 5 21-01-2010 08:26 PM
How to write java program to find factorial of number? Balamohan Software Development 5 28-11-2009 09:14 PM
how to write program on palindrome in java? Linoo Software Development 3 26-11-2009 04:19 PM


All times are GMT +5.5. The time now is 07:54 PM.