Help me in solving LBC17 problem

My issue

My code

// Update the code below to solve this problem

#include <iostream>
#include <string>
using namespace std;

int main() 
{
  int t;
  cin>>t; 
  while(t--)
  {
  int X, Y;
  cin>>X>>Y;
  if(X%10==0 && Y%10==0){
      cout<<((Y/10)-(X/10))<<endl;
  }
  else{
      if(X%10!=0){
          cout<<abs(((X/10)+1)-(Y/10))<<endl;
      }
      else{
           cout<<(((Y/10)+1)-(X/10))<<endl;
      }
  }
  
   }
return 0;
}

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

@gjit515
Some cases are missing like if both x and y are not divisible by 10 .
and also put abs in every cout.

thanks for your help

1 Like