Computer Programming
#includeint 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
U dont need loop for test case. only need to scan test case number once for this problem
#include
ReplyDeleteint 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
U dont need loop for test case. only need to scan test case number once for this problem
Delete