my answer is correct but the question dose not accept

#include<stdio.h>
//Q-- First and Last Digit ||Problem Code: FLOW004

int main(){
int a,n,x,y,sum;
sum=0;
scanf("%d\n",&a);
for(int i=0;i<a;i++){
scanf("%d",&n);
y=n;
while(n!=0){
x=n%10;
if (y==n||n<10){
sum+=x;
}
n=n/10;
}
printf("%d\n",sum);
sum=0;}
return 0;}

Have you considered single digit numbers?

1 Like