Advertisement
moltenx

Untitled

May 10th, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. import java.util.*;
  2.     public class uva10783 {
  3.         public static void main(String [] args) {
  4.             Scanner scn = new Scanner(System.in);
  5.             int n = scn.nextInt();
  6.             for(int x=0;x<n;x++) {
  7.                 int a = scn.nextInt();
  8.                 int b = scn.nextInt();
  9.                 int total = 0;
  10.                 for(int y=a;y<=b;y++) {
  11.                     if((y%2)!=0)
  12.                         total += y;
  13.                 }
  14.                 System.out.println("Case "+(x+1) +": " +total);
  15.             }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement