22 lines
442 B
Java
22 lines
442 B
Java
package Course_Codes;
|
||
//输入两个9位以内的数,相加求其有多少进位
|
||
import java.util.Scanner;
|
||
|
||
public class 进位模拟 {
|
||
|
||
public static void main(String[] args) {
|
||
Scanner sc=new Scanner(System.in);
|
||
int a=sc.nextInt();
|
||
int b=sc.nextInt();
|
||
int count=0,temp=0;//count——统计,temp——存放进位
|
||
for(int i=0;i<9;i++) {
|
||
temp=(a%10+b%10)>=10?1:0;
|
||
count+=temp;
|
||
a/=10;
|
||
b/=10;
|
||
}
|
||
System.out.print(count);
|
||
}
|
||
|
||
}
|