Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Justin Tran
- //2/9/16
- import java.util.Scanner;
- public class HW1
- { public static void main(String [] args)
- { Scanner input = new Scanner(System.in);
- System.out.print("Enter The start integer.");
- int a = input.nextInt();
- System.out.print("Enter The end integer.");
- int b = input.nextInt();
- System.out.println("Start integer: " + a);
- System.out.println("End integer: " + b);
- int c=0;
- int d=0;
- int t=0;
- for (int x =a; x<=b; x++)
- { t=x + t; if (t%2 == 0) c++; else d++; }
- System.out.println("Total: "+t); System.out.println("Even count: " + c); System.out.println("Odd count: " + d); }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement