Search found 1 match

by HIRA_iit_du
Wed May 04, 2011 10:31 pm
Forum: Volume 107 (10700-10799)
Topic: 10783 - Odd Sum
Replies: 34
Views: 15126

Re: 10783 - Odd Sum

Can anybody help me what's the wrong with this code?
#include<stdio.h>

int main(){
int n,i,j,l,s,m=0,a[100],b[100];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %d",&a,&b);}
for(i=0;i<n;i++){
s=0;
for(j=a;j<=b;j++){
if(j%2==1)
s+=j;}m++;
printf("case %d: %d\n",m,s);}

return 0;
}

Go to advanced search