Uva 10783 – Odd Sum

Problem:-http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1724



Solution :-

#include<stdio.h>
int main()
{
int a,b,c,s,i,j;
while (scanf(“%d”,&c)==1)
{
for(i=1;i<=c;i++)
{
scanf(“%d %d”,&a,&b);
s=0;
if(a%2==0)
a=a+1;
for(j=a;j<=b;j=j+2)
s+=j;
printf(“Case %d: %dn”,i,s);
}
}
return (0);
}

At First you can try to solve this problem if you can’t than see this code & find what’s your problem . If you copy paste this code you could not improve yourself in programming .

Posted by Shipu Ahamed

Leave a Reply