While loop Statement

Ads
 

While loop Statement

How to print a table using while loop?

View Answers

June 8, 2012 at 6:34 PM

The given example displays the multiplication table of the given number. This program accepts the integer value generate the table of that number.

public class WhileDemo{
         public static void main(String []args){
             int x =5;
              int y =1;
            System.out.println(" Table of " + x +" = ");
              while(y<=10)
              {
              int t = x * y;
              System.out.println(t);
              y++;
            }

           }
        }




 Output
Table of 5 = 
5
10
15
20
25
30
35
40
45
50

Ads









Related Tutorials/Questions & Answers:
While loop Statement.
While loop Statement.   How to Print Table In java using While Loop
While loop Statement
While loop Statement  How to print a table using while loop?   The given example displays the multiplication table of the given number... +" = "); while(y<=10) { int t = x
Advertisements
While Loop Statement in java 7
While Loop Statement in java 7 This tutorial, helps you to understand the concept of while loop  in java 7. While Loop Statements : While loop is most used loop in programming. We put the condition with in the while loop
While Loop
While Loop       Loop... the repetitious work then you use the Loop control statement. There are mainly three types of loops. Loop repeats a statement or a process multiple times
do while loop
do while loop       In java a do while loop is a control flow statement that allows a certain code... becomes false. Here is the syntax for the do while loop. The Syntax for the do
While Loop in JSP
While Loop in JSP          The while loop is a control flow statement.... In while loop the condition is firstly evaluated, if it finds that the condition
while & do..while Loop
while & do..while Loop while loop The while loop iterate until provided condition is true. Given below the syntax : while (condition)  ... : Value of j 1Value of j 2Value of j 3 The do...while statement The do-while
How to write a loop and a while loop
How to write a loop and a while loop  How do I write a 1 loop and a 1 while loop for the example code: public boolean isTheFirstOneBigger (int num1, int num2) { if (num1 > num2) { return true
Memory leak in While loop
Memory leak in While loop  How to manage a memory leak in While loop ?   make sure loop is not running infinitley...;make sure loop is not running infinitley
do-while loop
do-while loop  how many times will the following loop get executed and what will be the final value of the variable I after execution the loop is over. int I = 5; do{ I + = 3; System.out.println(""+I); I=I+1; }while(I>=9
Use while loop in jsp code
Use while loop in jsp code       While loop is a control flow statement that works...;       While loop checks the condition before the body
Do-while loop in Java
that at least once a block of statement will executed. do-while loop execute... if the condition is true then only the statement inside the while loop will be executed, otherwise the control will jump outside the while loop. Syntax: do{ statement
while loop handling
while loop handling  Dear deepak, thanks for your response yesterday.. I am doing a project on travelling domain.. in that initially i searched all... option the while loop always taking tyhe last flight datails only... and in all
Do While Loop in Java
); In this example you will see how to use the do-while loop statement. The values...Do while loop in Java There are three loops most commonly used in Java e.g. While loop, Do….While loop, and For loop. These loops are used
While Loop with JOptionPane
While Loop with JOptionPane  Hello there, why the output only... int k = 5; String name; int age; while(i < k...[]=new String[5]; int arr[]=new int[5]; while(i < k){ String name
Use if statement with LOOP statement
Use if statement with LOOP statement   ... with Example The Tutorial illustrate a example from if statement with LOOP statement. In this example we create a procedure display that accept
programes on while loop
programes on while loop   write a program to calculate sum of an entered digit write a program to find gcd and lcm of 2 positive integers   Java sum of digits Java Find LCM and GCD
Character count by while loop
Character count by while loop  Write the program to count the number of characters entered until a full stop (.)is keyed-in. Anyone there pls help with this question...   import java.io.*; import java.util.*; class
do-while Loop in Java
that check the condition then we use the do-while loop statement. do-while loop is same as the while loop statement but while loop checks the certain condition... do-while Loop in Java      
Using while loop to loop through a cursor
Using while loop to loop through a cursor  ... while loop to loop through a cursor'. The Example create a table Stu_Table... that establish the result set. The While loop check a condition
java code using while loop
java code using while loop  
Writing a loop statement using Netbean
Writing a loop statement using Netbean  Write a loop program using NetBeans.   Java Loops class Loops{ public static void main(String[] args){ int sum=0; for(int i=1;i<=10;i
Finding a Factorial using while loop
Finding a Factorial using while loop   ... are going to find out the factorial of 12 by using the while loop. In while loop... .Now use while loop and pass the condition that until temp> 0, the loop
For Loop Statement in java 7
For Loop Statement in java 7 In this section, we will discuss about for loop in java 7. This is one type of  loop statement. For Loop Statements : For loop is one way of looping to iterate block of code under certain condition
Break Statement in JSP
early from the loop. It allows the program to escape from the for, while, switch... are using the switch statement under which we will use break statement. The for loop...Break Statement in JSP      
Finding a Factorial using while loop
Finding a Factorial using while loop     ... the while loop. In while loop the loop will run until the condition we have given... to calculate the factorial .Now use while loop and pass the condition that until
While loop break causing unwanted output
While loop break causing unwanted output  Below I will paste my code. My problem is that when I run this I get to input a int and if correct...);{ while(counter != answer){ numc = job.nextInt(); if(numc != answer
How to use 'for' loop in jsp page?
'for' loop in jsp page. 'if' statement is used to test conditions while 'for' loop is used to define a loop that reiterates statements. It specifies... How to use 'for' loop in jsp page?   
Break statement in java
control flow of  compound statement like while, do-while , for. Break.... Break is used with for, while and do-while looping statement and break...; loop. Within a loop if a break statement is encountered then control resume
Do-while loop Statement in java 7
How to delete the row from the Database by using while loop in servlet
How to delete the row from the Database by using while loop in servlet ... details. While loop is not terminate, in while loop why If condition... mistake and in while loop why if loop not working. please give me solution

Ads