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



Home Answers Viewqa Java-Beginners print hello n hi
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sabeena
print hello n hi
1 Answer(s)      2 years 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 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 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 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
Print
into the stream and, as opposed to print() method, gets you to the new line after the text
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
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..  <!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
 

 

 

DMCA.com