Tuesday, 10 February 2015

Light OJ 1000 no problem c solution

#include<stdio.h>
int main()
{
    int i,j,sum=0,a,k,l,h;
    scanf("%d",&a);
    for(i=1;i<=a;i++){
        scanf("%d%d",&k,&l);
            sum=k+l;
            printf("Case %d: %d\n",i,sum);

    }


    return 0;
}

2 comments:

  1. #include
    int main()

    {
    int n,i,a,b;

    while( (scanf("%d",&n))==1)
    {


    for(i=1;i<=n;i++)
    {


    scanf("%d %d",&a,&b);

    if((a<=10)&&(b<=10))

    printf("case %d: %d\n",i, a+b);

    }
    break;

    }
    return 0;

    }





    what is the problem in my code?? it's giving wrong ans

    ReplyDelete
    Replies
    1. U dont need loop for test case. only need to scan test case number once for this problem

      Delete