Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package chapterSix;
- import java.util.Scanner;
- public class Variousloops
- {
- public static void main(String[] args)
- {
- Scanner s = new Scanner(System.in);
- int OddsSum=0;
- int a;
- int b;
- System.out.println("Minimum");
- a = s.nextInt();
- System.out.println("Maximum");
- b = s.nextInt();
- for(int j=a; j>=a && j<=b; j+=2)
- {
- OddsSum = OddsSum + j;
- }
- System.out.println(OddsSum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement