Public paste
whileloop
By: microhaxo | Date: Nov 12 2008 01:59 | Format: None | Expires: never | Size: 764 B | Hits: 1022

  1. import java.util.Scanner;
  2. public class InputRange
  3. {
  4.         public static void main(String[] args)
  5.         {
  6.                 String f ="0";
  7.                 String s ="0";
  8.                 String t ="0";
  9.                 Scanner scan = new Scanner(System.in);
  10.                 System.out.println ("What number starts the range?");
  11.                 f = scan.nextLine();
  12.                 System.out.println ("what number ends the range?");
  13.                 s = scan.nextLine();
  14.                 System.out.println("what number do you increment by?");
  15.                 t = scan.nextLine();
  16.                 System.out.println("The numbers in the range from " + f + " to " + s + " incremented by " + t);
  17.                 int first = Integer.parseInt(f);
  18.                 int second = Integer.parseInt(s);
  19.                 int third = Integer.parseInt(t);
  20.                 while (first < third)
  21.                 {
  22.                 System.out.println("count is : " + f);
  23.                         first++;
  24.                         first=+third;
  25.                         }
  26.                 }
  27.         }