Compilation successfull, but not submitting,saying wrong answer

Chef’s son Chefu found some matches in the kitchen and he immediately starting playing with them.

The first thing Chefu wanted to do was to calculate the result of his homework — the sum of A and B, and write it using matches. Help Chefu and tell him the number of matches needed to write the result.The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
The first and only line of each test case contains two space-separated integers A and B.
import java.util.Scanner;

public class MATCHISTICS {

public static void main(String[] args) {
	Scanner input=new Scanner(System.in);
	int t=input.nextInt();
	int i=0;
	while(i<t) {
	int a=input.nextInt();
	int b=input.nextInt();
	int n=a+b;
	match(n);
	i++;
	}

}
public static void match(int n) {
	 int total=0;
	 while(n!=0) {
           int temp=n%10;
           n=n/10;
           if(temp==2||temp==3||temp==5) total=total+5;
           else if(temp==6||temp==9) total=total+6;
           else if(temp==1) total=total+2;
           else if(temp==0) total=total+8;
           else if(temp==4) total=total+4;
           else if(temp==7) total=total+3;
           else if(temp==8) total=total+7;
	 }
	 System.out.println(total);
}

}

Brother, you have attached link to a wrong question. Please attach the correct link.

  1. https://www.codechef.com/problems/CUTBOARD

2)https://www.codechef.com/problems/MATCHES THIS ONE I HAVE DONE THIS CODING. BUT DONT KNOW WHAT IS WRONG.

For 0 you should add 6 and not 8

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.