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..

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
ModuleNotFoundError: No module named 'print_hello'
ModuleNotFoundError: No module named 'print_hello'  Hi, My Python... 'print_hello' How to remove the ModuleNotFoundError: No module named 'print_hello' error? Thanks   Hi, In your python environment
Advertisements
ModuleNotFoundError: No module named 'my-print-hello'
ModuleNotFoundError: No module named 'my-print-hello'  Hi, My... named 'my-print-hello' How to remove the ModuleNotFoundError: No module named 'my-print-hello' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'print-hello-world'
ModuleNotFoundError: No module named 'print-hello-world'  Hi, My... named 'print-hello-world' How to remove the ModuleNotFoundError: No module named 'print-hello-world' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'agatha-print-hello'
ModuleNotFoundError: No module named 'agatha-print-hello'  Hi, My... named 'agatha-print-hello' How to remove the ModuleNotFoundError: No module named 'agatha-print-hello' error? Thanks   Hi, In your
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
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
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
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
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
hello
Java Error in Hello World  Java Error in Hello World
hello
Java Hello World  HELLO World program in Java
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
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
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..ADS_TO_REPLACE_5   Hello Friend, We have
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,  Hi,what is the purpose of hash table
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... appreciate it... :)... i've another question..n try to do it... an internet... get unlimited access"); } System.out.println ("Total monthly bill \n
Hi,
Hi,   labels = new Hashtable<Integer,JLabel>
Hi..
Hi..   what are the keywords available in simple HelloWorld program
Hi..
Hi..  what are access specifier available in java
HI.
HI.  hi,plz send me the code for me using search button bind the data from data base in dropdownlist
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  Hi this is really good example to beginners who is learning struts2.0 thanks
Hi
Hi  Hi How to implement I18N concept in struts 1.3? Please reply to me
hi....
hi....  plzz sent me d code for counting vowels in a string... gui programme
Hi
Hi   how to read collection obj from jsp to servlet and from jsp - jsp?   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 http://www.roseindia.net/jsp/servlet-jsp-data-list.shtml Thanks
Hi
Hi  I want import txt fayl java.please say me...   Hi, Please clarify your problem! 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 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  Hi All, I am new to roseindia. I want to learn struts. I do not know anything in struts. What exactly is struts and where do we use it. Please help me. Thanks in advance. Regards, Deepak
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
hi!
hi!  how can i write aprogram in java by using scanner when asking user to enter element user will be free to enter any type that he/she wants to to enter, like(int,double,float,String,....) thanx for answering....   Hi

Ads