-
Notifications
You must be signed in to change notification settings - Fork 15
/
Logic.java
40 lines (40 loc) · 949 Bytes
/
Logic.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.util.*;
public class Logic
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int t=in.nextInt();
while(t>0)
{
int n1=in.nextInt();
int n2=in.nextInt();
int t1=n1;
int t2=n2;
int c=0;
int carry=0;
String car="";
while(t2>0)
{
int y=t2%10;
carry=0;
t1=n1;
while(t1>10)
{
int x=t1%10;
int z=x*y+carry;
carry=z/10;
if(carry>0)
{
car=car+carry;
c++;
}
t1=t1/10;
}
t2=t2/10;
}
System.out.println(c+" "+car);
t--;
}
}
}