My issue
can you please help me to solve
My code
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
while(t-- >0)
{
int x=scanner.nextInt();
int y=scanner.nextInt();
System.out.println(calculateMinimumInvestment(x,y));
}// your code goes here
}
public static int calculateMinimumInvestment(int x,int y)
{
int investment=0;
int diff=x-y;
while(diff>0)
{
investment += diff;
diff=diff/2;
}
return investment;
}
}
Problem Link: Saving Taxes Practice Coding Problem - CodeChef