Pabon_SEC

Odd sum

Sep 3rd, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     long long int t,a,b,n,i,j;
  5.     scanf("%lld",&t);
  6.     for(i=1;i<=t;i++)
  7.     {
  8.         n=0;
  9.         scanf("%lld%lld",&a,&b);
  10.         for(j=a;j<=b;j++)
  11.         {
  12.             if(j%2==0)
  13.             continue;
  14.             if(j%2==1)
  15.             {
  16.                 n=n+j;
  17.             }
  18.         }
  19.         printf("Case %lld: %lld\n",i,n);
  20.     }
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment