Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /*
- * HW4 CountBy
- * Kenny Lo 12
- * September 2018
- * Professor Stefan
- * CSE 1310-001 T-TH 9:30 AM to 10:50 AM
- */
- public class HW4_CountBy {
- public static void main(String[] args) {
- Scanner kb = new Scanner(System.in);
- // Define Variables
- int start, end, step;
- String output = "";
- // Prompt
- System.out.println("This program will be counting by a certain step.");
- System.out.println("Enter what you want the start, end and stop values to be.");
- System.out.print("start is: ");
- start = kb.nextInt();
- System.out.print("end is: ");
- end = kb.nextInt();
- System.out.print("step is: ");
- step = kb.nextInt();
- for (int st = start; st <= end; st+=step){
- output = output.
- }
- System.out.print("The sequence is: ");
- System.out.print(st);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment