Page 3 of 3

Odd sum

Posted: Fri May 31, 2013 1:56 am
by RoniphpBB
AC

Re: Odd sum

Posted: Fri May 31, 2013 3:43 pm
by sohel
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!

Re: Odd sum

Posted: Sat Jun 01, 2013 1:59 pm
by RoniphpBB
Many many thanks to you Brother sohel

Re: 10783- Why WA??

Posted: Thu Feb 13, 2014 1:18 pm
by rloursua
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;
}

Re: 10783- Why WA??

Posted: Fri Feb 14, 2014 12:31 am
by brianfry713
Print a newline char at the end of the last line.