|
| ||||||||||
| Tags: compiler, java, java language, nested loop, programming |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Need help to write this program in java?
-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. |
|
#2
| ||||
| ||||
| 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 ![]()
__________________ Education, Career and Job Discussions |
![]() |
|
| Thread Tools | Search this Thread |
| |
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 |