# Help me in solving LBCC21 problem

### My code

``````#include <stdio.h>

int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int P, score100, score1, problems_solved;
scanf("%d", &P);
score100 = P / 100;
score1 = P % 100;
problems_solved = (score100) + (score1/10);
if (score1 % 10 == 0 && problems_solved <= 10)
{
int problems_solved_new = problems_solved + score1;
printf("%d\n", problems_solved_new);
} else
{
printf("-1\n");
}
}
return 0;
}

``````

Learning course: Solve Programming problems using C
Problem Link: CodeChef: Practical coding for everyone

@njyotirvinay
few mistakes i have corrected it in your code.

include <stdio.h>

int main()
{
int t;
scanf(β%dβ, &t);
while (tβ)
{
int P, score100, score1, problems_solved;
scanf(β%dβ, &P);
score100 = P / 100;
score1 = P % 100;
problems_solved = (score100) + score1;
if ( problems_solved <= 10)
{
int problems_solved_new = problems_solved ;
printf(β%d\nβ, problems_solved_new);
} else
{
printf(β-1\nβ);
}
}
return 0;
}

thanks it works but during submission it still says wrong answer

@njyotirvinay
can u send me the code for which u r getting wrong answer

for the code you have changed itβs still getting wrong answer. Iβve even tried in multiple ways but it still says wrong answer.

@njyotirvinay

``````#include<stdio.h>

int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int P, score100, score1, problems_solved;
scanf("%d", &P);
score100 = P / 100;
score1 = P % 100;
problems_solved = (score100) + score1;
if ( problems_solved <= 10)
{
int problems_solved_new = problems_solved ;
printf("%d\n", problems_solved_new);
} else
{
printf("-1\n");
}
}
return 0;
}
``````

actually the thing is when iβm sending it its making some changes like in printf and scanf " " and instead of t-- in while loop its making t- only that is why its making error.
for more clarity please refer this its the same code ss.

hey thanks for the help and iβve noticed those errors and iβve corrected them, the actual thing is either with the time complexity or the ide bug. thanks for the help

1 Like