Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #include<iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     ifstream cin("10783.in");
  7.     ofstream cout("10783.out");
  8.     int a,b,n,sum;
  9.     cin>>n;
  10.     for(int i=0; i<n; i++)
  11.     {
  12.         cin>>a>>b;
  13.         sum =0;
  14.  
  15.         for(int j=a; j<=b; j++)
  16.         {
  17.             if(j%2!=0)
  18.  
  19.                 sum=sum+j;
  20.  
  21.         }
  22.         cout<<"Case "<<i+1<<": " <<sum<<endl;
  23.     }
  24.     cout<<endl;
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement