## 10783 - Odd Sum

All about problems in Volume 107. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

RoniphpBB
New poster
Posts: 10
Joined: Sat Feb 09, 2013 11:22 am

### Odd sum

AC
Last edited by RoniphpBB on Sat Jun 01, 2013 2:08 pm, edited 1 time in total.

sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

### Re: Odd sum

What is your output for the following input:

2 10

and look for threads related to your problem by using the search option on the top-right. Make your post in an existing thread - don't create a new one!

RoniphpBB
New poster
Posts: 10
Joined: Sat Feb 09, 2013 11:22 am

### Re: Odd sum

Many many thanks to you Brother sohel

rloursua
New poster
Posts: 4
Joined: Tue Feb 11, 2014 5:52 pm

### Re: 10783- Why WA??

Could somebody help me? why do i get getting WA

Code: Select all

``````#include <iostream>
using namespace std;

int main()
{
int test=0;
int a,b;
cin >> test;
for( int i=0; i<test ;i++)
{
cin >> a >> b;
int j=a;
int sum=0;
for(j=a;j<=b;j++)
{
if(j%2)
sum=sum+j;
}
if(i!=test-1)
cout << "Case " << i+1 << ": " << sum << endl;
else
cout << "Case " << i+1 << ": " << sum;
}
return 0;
}
``````

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 10783- Why WA??

Print a newline char at the end of the last line.
Check input and AC output for thousands of problems on uDebug!