Home / Programs / While Loop Example, print 10 to 19
🚀 Programming Example

While Loop Example, print 10 to 19

👁 1,683 Views
💻 Practical Program
📘 Step Learning
While Loop Example, print 10 to 19

💻 Program Code

 public class LoopExample {

   public static void main(String args[])
   {
      int x = 10;

      while( x < 20 )
      {
         System.out.print("value of x : " + x );
         x++;
         System.out.print("\n");
      }
   }
}

                        

🖥 Program Output

value of x : 10
value of x : 11
value of x : 12
value of x : 13
value of x : 14
value of x : 15
value of x : 16
value of x : 17
value of x : 18
value of x : 19
Press any key to continue . . .
                            
📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.