JAVA语言程序设计 编程练习题3.9(商业:检验ISBN-10)

3.9(商业:检验ISBN-10)ISBN-10(国际标准书号)由10个个位整数\LARGE d_{1}d_{2}d_{3}d_{4}d_{5}d_{6}d_{7}d_{8}d_{9}d_{10}组成,最后一位\LARGE d_{10}是校验和,它是使用下面的公式用另外9个数计算出来的:
(d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9)%11
如果校验和为10,那么按照ISBN-10的习惯,最后一位应该表示为X。编写程序,提示用户输入前9个数,然后显示10位ISBN(包括前面起始位置的0)。程序应该读取一个整数输入。
以下是一个运行示例:

Enter the first 9 digits of an ISBN as integer:013601267

The ISBN-10 number is 0136012671

Enter the first 9 digits of an ISBN as integer:013031997

The ISBN-10 number is 013031997X

import java.util.Scanner;
public class TestISBN_10 {
   

	public static void main(String[] args) {
   
		Scanner input=new Scanner(System.in);
		System.out.print("Enter
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值