Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners print hello n hi

Have Programming Question? Ask it here!
 
 
 


sabeena
print hello n hi
1 Answer(s)      a year and 9 months ago
Posted in : Java Beginners


how to write a java program that prints "hello" 5 times, "hi" 1 time n again "hello" 4 times..?? do reply..


Advertisement
View Answers

November 10, 2012 at 1:00 PM


class HelloTest {
    public static void main(String[] args) {
        int i = 5, j = 1;
        while (j <= 5) {
            for (int x = 1; x <= i; x++) {
                System.out.println(x + " - Hello");
            }
            for (int y = 1; y <= j; y++) {
                System.out.println(y + " - Hi");
            }
            i--;
            j++;
        }
    }
}


Related Tutorials/Questions & Answers:
print hello n hi
print hello n hi  how to write a java program that prints "hello" 5 times, "hi" 1 time n again "hello" 4 times..?? do reply
write a java program to print marklist of "n " students. input Register number, name and marks of three subjects.
write a java program to print marklist of "n " students. input Register number, name and marks of three subjects.  write a java program to print marklist of "n " students. input Register number, name and marks of three subjects
Advertisements
Write a java program that prints the decimal representation in reverse. (For example n=173,the program should print 371.)c
. (For example n=173,the program should print 371.)c  class rose { int n; int i; rose(int n,int i) { n=173; i=371; } void out { System.out.println("Enter the number"+n); System.out.println("\nReverse the number"+i); } Public
how to print hello world every second till i have pressed enter key
how to print hello world every second till i have pressed enter key  how to print hello world every second till i have pressed enter key
how to print the content of file in 2d matrix having same dimension as given in file(n*m).
how to print the content of file in 2d matrix having same dimension as given in file(n*m).   here is code: import java.io.File; import... to specify no. of columns every time. it is not the case. but i want to print the file
how to print the average of each column of 2d n*m array using java
how to print the average of each column of 2d n*m array using java  ...).useDelimiter("\n"); while (scanner.hasNext... in the given file having say n*m matrix.   import java.io.File; import
hello
Java Error in Hello World  Java Error in Hello World
hello
Java Hello World  HELLO World program in Java
hello
another question..n try to do it... an internet service provider has three..."); } System.out.println ("Total monthly bill \n" + payrate); } } i think there is so many error...please try check it out..   Hello Friend, We have
hello
hello  how to print from a-z, A-Z with exact order using for loop? Thanks for all concern
hello
character is vowel or not.   Hello Friend, Try the following code... it... :)... i've another question..n try to do it... an internet service provider has... monthly bill \n" + payrate); } } i think there is so many error
Hello
Hello  Hello sir i want to store upload doc file in ms access by using servlet. Can i store file in access.one another things access only text size is 255 character but my file is up to 2mb how i can store
Hello ..
Hello ..  Hello, I need a code for .. Want to read csv file (which is having name nd mobile number) from jsp and if i give search by name mobile number should get displayed and if i give mobile number name should get
print the newline
print the newline  Why doesn?t the following code print the newline properly? <?php $str = ?Hello, there.\nHow are you?\nThanks for visiting.?; print $str; ?>   Hi friends, Inside the single quotes \n (newline
hi,
hi,  print("code sample");how to display all elements in 2d array usin any one loop
hi
hi   'print("code sample");`class example(){ public.static.void.main(); system.out.println("this is first pro");}   class example{ public static void main(String[]args){ System.out.println("this is first pro
print
print  How to print JFrame All Componant?   Please visit the following link: http://www.roseindia.net/java/example/java/swing/Print.shtml
hi
hi  what is the code for printing stars as follows * * * * * * * * * *print("code sample");   Hi Friend, Try... num=4; int p = num; int q = 0; for (int i = 0; i <= num; i++) { for (int j
Print
into the stream and, as opposed to print() method, gets you to the new line after the text
Hi,
Hi,  Hi,what is the purpose of hash table
hi
hi  i want to use dropdown list(combo box) in html...it should contain name of country's i,e fetched from db...country names should come from db to html dropdown list...and when user selects perticular country it should go 2 db n
hi
hi  i want to use dropdown list(combo box) in html...it should contain name of country's i,e fetched from db...country names should come from db to html dropdown list...and when user selects perticular country it should go 2 db n
hi
hi  i want to use dropdown list(combo box) in html...it should contain name of country's i,e fetched from db...country names should come from db to html dropdown list...and when user selects perticular country it should go 2 db n
hi
hi  i want to use dropdown list(combo box) in html...it should contain name of country's i,e fetched from db...country names should come from db to html dropdown list...and when user selects perticular country it should go 2 db n
Hi..
Hi..   what are the keywords available in simple HelloWorld program
Hi..
Hi..  what are access specifier available in java
Hi,
Hi,   labels = new Hashtable<Integer,JLabel>
HI.
HI.  hi,plz send me the code for me using search button bind the data from data base in dropdownlist
hi..
hi..  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page contentType="text/html... = "Ilegal ENCTYPE : must be multipart/form-data\n"; err += "ENCTYPE set
hi..
hi..  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page contentType="text/html... = "Ilegal ENCTYPE : must be multipart/form-data\n"; err += "ENCTYPE set
hi..
hi..  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page contentType="text/html... = "Ilegal ENCTYPE : must be multipart/form-data\n"; err += "ENCTYPE set
hi..
hi..  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page contentType="text/html... = "Ilegal ENCTYPE : must be multipart/form-data\n"; err += "ENCTYPE set
hi..
hi..  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page contentType="text/html... = "Ilegal ENCTYPE : must be multipart/form-data\n"; err += "ENCTYPE set
hi..
hi..  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page contentType="text/html... = "Ilegal ENCTYPE : must be multipart/form-data\n"; err += "ENCTYPE set
hi..
hi..   I want upload the image using jsp. When i browse the file then pass that file to another jsp it was going on perfect. But when i read...-data")) { err = "Ilegal ENCTYPE : must be multipart/form-data\n"; err
hi..
hi..   I want upload the image using jsp. When i browse the file then pass that file to another jsp it was going on perfect. But when i read...-data")) { err = "Ilegal ENCTYPE : must be multipart/form-data\n"; err
hi..
hi..   I want upload the image using jsp. When i browse the file then pass that file to another jsp it was going on perfect. But when i read...-data")) { err = "Ilegal ENCTYPE : must be multipart/form-data\n"; err
hi..
hi..   I want upload the image using jsp. When i browse the file then pass that file to another jsp it was going on perfect. But when i read...-data")) { err = "Ilegal ENCTYPE : must be multipart/form-data\n"; err
hi..
hi..   I want upload the image using jsp. When i browse the file then pass that file to another jsp it was going on perfect. But when i read...-data")) { err = "Ilegal ENCTYPE : must be multipart/form-data\n"; err
hi..
hi..   I want upload the image using jsp. When i browse the file then pass that file to another jsp it was going on perfect. But when i read...-data")) { err = "Ilegal ENCTYPE : must be multipart/form-data\n"; err
hi..
hi..   I want upload the image using jsp. When i browse the file then pass that file to another jsp it was going on perfect. But when i read...-data")) { err = "Ilegal ENCTYPE : must be multipart/form-data\n"; err
Hi..
Hi..  null is a keyword.True/False?   hi friend, In Java true, false and null are not a Java keyword they are literals in Java. For reading in detail go through the following link The null keyword
hi....
hi....  plzz sent me d code for counting vowels in a string... gui programme
Hi
Hi  Hi How to implement I18N concept in struts 1.3? Please reply to me
Hi
Hi  Hi this is really good example to beginners who is learning struts2.0 thanks
Hi
Hi   how to read collection obj from jsp to servlet and from jsp - jsp?   Hi Friend, Please visit the following link: http://www.roseindia.net/jsp/servlet-jsp-data-list.shtml Thanks
hi....
hi....  a programme which displays a combobox which contains num from 1 to 10 and calculates the factorial of dt num which user clicks
Hi
Hi  I want import txt fayl java.please say me...   Hi, Please clarify your problem! Thanks
hi
hi   I have connected mysql with jsp in linux and i have used JDBC connectivity but when i run the program, its not working the program is displaying
Hi..
Hi..  diff between syntax and signature?   signature is a particular identity of a method in terms of its argument order ,type and their number e.g. void A(arguments) then here the order ,type and number of arguments
 

 

 

DMCA.com