Home Answers Viewqa Java-Beginners print hello n hi

 
 


sabeena
print hello n hi
1 Answer(s)      6 months and 16 days 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..

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 Pages:
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
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
hello
hello  how to print from a-z, A-Z with exact order using for loop? Thanks for all concern
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
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
JAVA N HTML - JavaMail
JAVA N HTML  How to use HTML's mailto tag in a java application... monday... Please Help Me.. Thanks Vamsi Krishna  Hi Friend... = response.getWriter(); pw.println(""); pw.println("Hello World
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
hello in vertical manner
hello in vertical manner  How to print HELLO as in vertical manner   Hi, Try this: class HelloExample { public static void main(String[] args) { String str="HELLO"; char ch[]=str.toCharArray
hi
hi  what is the code for printing stars as follows * * * * * * * * * *print("code sample");   Hi Friend, Try this: public class PatternExample { public static void main(String[] args) { int
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..   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..  <!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..  <!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
servlet n jsps - Java Beginners
servlet n jsps  How to do: 1.After log-out, if user cilick on "back... help  Hi friend, Please explain in detail. your posted question...://www.roseindia.net/jsp/ Thanks.   hello, 1 = you can disable
Hello World Program
Hello World Program  write a java program that continuously prints...   Hi Friend, Try the following code: public class... = new DisplayMessageContinuously("Hello World ", 1000); th.start
C Program to Print Following Output - Development process
C Program to Print Following Output  Hello Sir I wnat to print Followning output in C Language with for loop How I Can Print it? 5 5 4 5 4 3 5 4 3 2 5 4 3 2 1  Hi Friend, Try the following: #include
hello - Java Beginners
) __________ * ________ * * * _______ * * * * ______ * * * * * would you like to continue y or n: y Enter... or n: y Enter a character: C... * * * * * * * * * * * * * * * * * * * * * * * * * would you like to continue y or n: y
Print Form - Java Beginners
Print Form  Hello Sir I have Created Admission Form when user fills data and submit that data to access database,then when i Click on PRINT Button I want to get Print of that forms Contents,How I can Do it with JAVA SWING,plz
Clear the print button after onclicking the print - Ajax
the print button.....   Hi Friend, We have already provided...Clear the print button after onclicking the print  var disp_setting...=yes,width=700, height=330,left=300,top=325"; var rate_print=window.open
how to print - Java Beginners
how to print  how to print something on console without using System.out.print() method ?  Hi Friend, You can use PrintWriter to write anything on the console. import java.io.*; public class Print{ public static
print a rectangle - Java Beginners
print a rectangle  how do I print a rectangleof stars in java using simple while loop?Assuming that the length n width of the rectangle is given.  Hi friend, I am sending running code. import java.io.
n raised to power p
n raised to power p  wap to input 2 integers n and p.find and print n raised to the power p without using Math.pow() function
dotmatrix print with JasperReports - Development process
dotmatrix print with JasperReports  Hello, I was wondering how to print to a dotmatrix printer from a swing application. I also have to see a print preview of the page. Is this possible with Java, or maybe JasperReports
Hello - Struts
Hello  Hi Friends, Thakns for continue reply I want to going with connect database using oracle10g in struts please write the code and send me its very urgent only connect to the database code   Hi
Hello - Struts
Hello  Hi, Can u tell me what is hard code please send example of hard code...  Hi Friend ! Hard coding refers to the software development practice of embedding input or configuration data directly
Print a statement
Print a statement  hello what would we output for this statement System.out.println ("5"+"A" + 3);   hello output will be 5A3
Hello - Struts
Hello  Hi friends, I ask some question please read carefully and let me know I want to create installation file........it is possible... but how is possible in java  Hi friend, The standard Java
RMI n JSP - RMI
RMI n JSP  Hi Friends, First of all let me appreciate ur promptness in delivering answers. Is it possible to make communication between RMI and JSP page ? Thanks
RMI n JSP - RMI
RMI n JSP  Hi Friends, First of all let me appreciate ur promptness in delivering answers. Is it possible to make communication between RMI and JSP page ? Thanks
Label n Dropdown Issue
Label n Dropdown Issue  Hi guys, Some how Iam able to receive the data for labels, dropdowns. I created one array with the size of label, and statred for loop, inside this I created one more array of type above created
C Program to Print Stras - Development process
C Program to Print Stras  How I can Print Following Output using Two For loops in C Language? * * * * * * * * * * * * * * * *  Hi...; int j=0; for(i=1;i<=4;i+=1){ printf("\n"); for(j=1;j<=i;j++) printf
hello .. still doesn't run - Java Beginners
hello .. still doesn't run  Iam still having a prblem in running...]; int z; int per, d; System.out.print ("\n\tEntree\t"); System.out.print ("\t...{ for(int i=0;i<12;i++) System.out.println ("\n"+i+" "+o[i].Oname+" "+o[i
Printing numbers up to N into a file
Printing numbers up to N into a file  I'd like to print the first N integers, that is, "1, 2, 3, 4, ..., N-1, N", say N equals 1000, or 10000 or whatever. I'd also like to have the result stored as a file instead of having
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
how to check and print the no of times an integer is repeated in an array
how to check and print the no of times an integer is repeated in an array  how to check and print the no of times an integer is repeated... times 4-3 times 5-2 times 3-1 times   Hi Friend, Try the following code
print initials
print initials  How to print initials of a name without using arrays?   Hi Friend, You can try the following code: import java.util.*; public class InitialName { public static void main(String[] args

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.