LAST DIGIT SUM- what's the problem??

#include <stdio.h>
//#include <conio.h>
int main()
{
 //clrscr();
 int t;
 long m,n,num,sum=0,lsum=0,i;
 scanf("%d",&t);
 while(t--)
 {
  scanf("%ld%ld",&m,&n);
  for(i=m;i<=n;i++)
  {
   //num=i;
   while(i!=0)
   {
     num=i%10;
     i=i/10;
     if(num%2==0)
      sum=sum+2*num;
     else
      sum=sum+num;
   }
   lsum=lsum+(sum%10);
  }
 }
 printf("\n%ld",lsum);
 return 0;
 }

My opinion is, that the problem is that you didn’t test your code…

1 Like
//