1 喜歡 1 不喜歡
6.5k 瀏覽

The 13-digit International Standard Book Number (ISBN) is a unique code that identifies a book commercially. The last digit is a check digit used for error detection. To calculate its value, each digit of the first twelve digits is alternately multiplied, from left to right, by 1 or 3. The products are summed up and divided by 10. The check digit is the remainder of the division subtracted from 10. If it is 10, it becomes 0. 

ISBN檢查號的計算方法: 前12個數字,奇數項 乘以 1 , 偶數項乘以 3

For example, assume that the first twelve digits are 978960931961.  

假設號碼前12位是978960931961

(a) (9*1 + 7*3 + 8*1 + 9*3 + 6*1 + 0*3 + 9*1 + 3*3 + 1*1 + 9*3 + 6*1 + 1*3) = 126 

(b) The check digit = 10 – (126 % 10) = 10 – 6 = 4  

檢查號 = 10 - 餘數 = 10 – (126 % 10) = 10 – 6 = 4  

So the valid ISBN is: 9789609319614

Write a program that reads a 13-digit ISBN and checks the last digit to see if it is valid or not. 

寫一個輸入13位ISBN號碼 判斷最後一個數字是否檢查碼即可

#Try 1:

Input:

9789609319614

Output: 

Valid ISBN

 

#Try 2:

Input:

9781482214505

Output: 

Valid ISBN

 

#Try 3:

Input:

9780132936493

Output: 

Invalid ISBN

 

[考試] 最新提問 分類:Midterm | 用戶: (12.1k 分)
ID: 32706 - 從幾時開始: 2017-11-15 14:10 - 到幾時結束: 無限制
| 6.5k 瀏覽

49 個回答

0 喜歡 0 不喜歡
內容已隱藏
#include * * *
#include ** ** ** *

int main()
{
* **** ** *** *** *** * * ***
** * ** * *** *** * ** * * * * *** ***** *** * * * *** *** ** * ***** * * * * *** * * *** * * * * * * **
***** * * * *** * + b*3 + c*1 + d*3 + e*1 + f*3 + g*1 + h*3 + i*1 + j*3 + k*1 + l*3;
** *** **** ** *** * ** *** **
**** * ****** ******* (ans==m)
* ****** ** * * * * * ** *** **** ISBN");
** ** ** * *** ** ***
* ** * * * * * * * * * **** * * * ISBN");
** * ** **** ** * ** *** 0;
}
最新回答 用戶: (-258 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include ** * *

int main()
{
* ** *** * * ****** whole;

* ** *** * ***** * * * *** * **** * ** **** ** ***
* **** * * **** ** * ** * ** **** * * * * *** * * ** ** * ** * ** ** * **** * *** * * &n6, &n7, &n8, &n9, &n10, * *** ** ** * &n13);



whole = * * ** ** * ** * ** ***** ** * ** * ** *

int temp = whole%10;


if * *
*** ** * * ** * * * **
***** * ** ** ****** * ** * *** *** * * *** * * *** * ****** ISBN");
*** ** *** ** * * **
* **** * * *** * ***
** * * **** ** *****
**** * ** *** *********** * **** ** * * ** * ***** * ** ISBN");
* * * ** * **** ** * ***

* ****** * * * *** ** * 0;
}
最新回答 用戶: (323 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include * ***** **

int main()
{
* ** * * * * ** * * whole=0;

* ** ** ** *** * *** ** ** * * * ** **
* * * * * *** * * *** * ******* ** *** * * * * * ** * * * * ** * &n6, &n7, &n8, &n9, &n10, ***** * * * * ** &n13);



whole = ********* * ******** * * **** ** ** * ** ** * *******



if ((10-(whole%10))==n13)
*** ** * ** *** **** * ***
* * *** ** * ** ** * * * * * * *** *** *** *** ISBN");
*** * * * *** ** ** **
* * * *** *** ** *
* * ** * * * * * * *
* * *** * * *** * * ****** ** * ** ** * * ** ** ** ISBN");
* *** * * * * ***** * *

**** * * **** ** * 0;
}
最新回答 用戶: (323 分)
0 0
prog.c: In function 'main':
prog.c:8:11: warning: too many arguments for format [-Wformat-extra-args]
     scanf("%1d1d1d1d1d1d1d1d1d1d1d1d1d", &n1,&n2,&n3,&n4,&n5, &n6, &n7, &n8, &n9, &n10, &n11,&n12, &n13);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 喜歡 0 不喜歡
內容已隱藏
* * * * ** **** * *
main()
{
long int ** ** **** * *
* *** * *** input * * * *
* * * * ** ** **** **
if * ** ** * * *
** * ** ** ** ** ** ** **** ** * *** **
if ** *
* * ** * * ** ** ** *** *** * ** ** **

** ** ** *
*** * * ** ****
* ** ** * ** ** *
* *** * * * * **** **
** * ** * *
* * ** ** * * * *
****** *** ***
* * ** * *** **
* * *
** * *
** ********
m==a%100/10;//2
n==a%10;//1

** * ** * * ** * *
o==10-(sum%10);

if (n = o)
{
* * * ** * * * * ** ** * ** *** * ISBN");
}
if (n != o)
{
* * * **** * ** * * * *** ISBN");
}
return 0;
}
最新回答 用戶: (-32 分)
0 0
prog.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int]
 main()
 ^~~~
0 喜歡 0 不喜歡
內容已隱藏
#include * * * * * *

int main(){
*** * * * * long long int n;
* * *   int temp=0;
** *   int n1=0,n2=0;
** *** * ** ** int value[13];
***** *   int i,j;
*   int check;
* *   int value2;

***   * *** * *** * **

** * ** * for(i = 0; i < 13; i++){
*** * * * * * * **** ****** * *** * * * = n%10;
** ** *** * * * * ** * ** **** = temp*3;
* * ** * * * ** * * * * ** ** * * * * * * * * *

** ** * ** *** ** * * * ** * * ** * ** ** = n%10;
* * * * * ** * * * * ** * ****** *** * = temp;
* * ** *** **** * ** * ****** * ** * *** *** *
** * ** * ** * ********* * *** **** * *** *** * * = ** ** *
*** *** * **** *** * ** * * *** * * ** *
** *   }
*** * * * ** ** * **** ******* * ** ** * value2);

** * * ****** **** ******* *

** * *** *** **** ** * * * **
* ** * * * *** ****** ** * * *** * * ** ** * * *
*** **** * ** * ** *** ** **
** * * * ** * * * ** ** * * * ********** ** ** * * ***


*** *   return 0;
}
30/100 最新回答
0 0
prog.c: In function 'main':
prog.c:12:10: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'long long int *' [-Wformat=]
  scanf("%d", &n);
          ^
0 喜歡 0 不喜歡
內容已隱藏
#include *** *** ** *****
int main ()
{
***** * * * * a;
** *** *** * * ** * **** * * * **** **
* * ** ** ** * **** * * * ******* *
**** * ** * * * *** ** 0;
}
最新回答
0 0
prog.c: In function 'main':
prog.c:5:10: warning: too many arguments for format [-Wformat-extra-args]
    scanf("number",&a);
          ^~~~~~~~
prog.c:6:11: warning: too many arguments for format [-Wformat-extra-args]
    printf("Valid ISBM",a);
           ^~~~~~~~~~~~
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>
int main()
{
* *** * ** *** ** ** * a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, sum1,sum2, sum3, check;
* * ** **** * ** ****** *** ** ** ** * *** * *** * ** * *** ****** ** ** *** * * ** * **** * * * * * * * * **** * * * * * ** * * ** * **

*** *** *** *** *** ******* * *
** ** * * * * * ** * * ** ** **

* ***** ********* * *** * * sum1+sum2;
* *** ********* * * **** * * 10 - (sum3%10);

*** * ** ***** * * *
*** ** * ** ** * ** *
* * * **** *** ** * * ** **** *** * **** * ISBN");
* * * **** * * * ** * ***
**** * * * **** **** ***
* * * * * * ** **
* * ** ** * * ** **** * * ** ** *** * * * * ** IBSN");
* * *** *** * * **** ***

** * * *** * **** 0;
}
20/100 最新回答 用戶: (-233 分)
0 0
prog.c: In function 'main':
prog.c:5:14: warning: format '%ld' expects argument of type 'long int *', but argument 2 has type 'int *' [-Wformat=]
     scanf("%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld", &a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10,&a11,&a12,&a13);
              ^
prog.c:5:17: warning: format '%ld' expects argument of type 'long int *', but argument 3 has type 'int *' [-Wformat=]
     scanf("%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld", &a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10,&a11,&a12,&a13);
                 ^
prog.c:5:20: warning: format '%ld' expects argument of type 'long int *', but argument 4 has type 'int *' [-Wformat=]
     scanf("%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld", &a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10,&a11,&a12,&a13);
                    ^
prog.c:5:23: warning: format '%ld' expects argument of type 'long int *', but argument 5 has type 'int *' [-Wformat=]
     scanf("%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld", &a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10,&a11,&a12,&a13);
                       ^
prog.c:5:26: warning: format '%ld' expects argument of type 'long int *', but argument 6 has type 'int *' [-Wformat=]
     scanf("%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld", &a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10,&a11,&a12,&a13);
                          ^
prog.c:5:29: warning: format '%ld' expects argument of type 'long int *', but argument 7 has type 'int *' [-Wformat=]
     scanf("%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld", &a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10,&a11,&a12,&a13);
                             ^
prog.c:5:32: warning: format '%ld' expects argument of type 'long int *', but argument 8 has type 'int *' [-Wformat=]
     scanf("%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld", &a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10,&a11,&a12,&a13);
                                ^
prog.c:5:35: warning: format '%ld' expects argument of type 'long int *', but argument 9 has type 'int *' [-Wformat=]
     scanf("%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld", &a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10,&a11,&a12,&a13);
                                   ^
prog.c:5:38: warning: format '%ld' expects argument of type 'long int *', but argument 10 has type 'int *' [-Wformat=]
     scanf("%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld", &a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10,&a11,&a12,&a13);
                                      ^
prog.c:5:41: warning: format '%ld' expects argument of type 'long int *', but argument 11 has type 'int *' [-Wformat=]
     scanf("%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld", &a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10,&a11,&a12,&a13);
                                         ^
prog.c:5:44: warning: format '%ld' expects argument of type 'long int *', but argument 12 has type 'int *' [-Wformat=]
     scanf("%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld", &a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10,&a11,&a12,&a13);
                                            ^
prog.c:5:47: warning: format '%ld' expects argument of type 'long int *', but argument 13 has type 'int *' [-Wformat=]
     scanf("%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld", &a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10,&a11,&a12,&a13);
                                               ^
prog.c:5:50: warning: format '%ld' expects argument of type 'long int *', but argument 14 has type 'int *' [-Wformat=]
     scanf("%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld%ld", &a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10,&a11,&a12,&a13);
                                                  ^
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <stdlib.h>

int main()
{

* ** ** ** * ** ******** isbn;
**** * * * * * ** * s1;
**** *** *** * * * *** * s2;
* * *** **** ** * ** **** s3;
* ***** * * * ****** s4;
** * * * ****** * *** s5;
** **** * * *** ** * * * ** ** s6;
** **** **** ***** ****** * * s7;
** * *** * * * ** ** s8;
******* * * * * ** * * ** s9;
**** * **** ****** *** * s10;
* *** * ** *** ** ** ** * * s11;
* ** * * ** * ******* s12;
** * *** * *** ** *** * s13;
    int check;
* * ** * * **** * ** * *** sum;

** * * ** * ** * **** * ** ** ** * *** *

** * * *** ***** * ** ** ** * * ** *
** ** * * ** **** * ** *** * *** ** *
* ** * ** ** * *** * * * *** ****
* * * * * * ** ** ** *** * ** **** *
*** * * ** ** * ** * * * * * * * ** *
* ****** ****** ** ** * * * ** * * *** *** *
* **** * * * * *** **** *** *** ***
*** ***** ** ** **** * * ** * ** ***
** ****** *** **** * *** **
* ** ** * * * * ** * * ** * * *
**** ** * ****** ** * ** ** * *** **
* * * * ****** * * *** ** ** * * ****
* * ** * * ** **** * *** * *** **

** * ** * ** * *** ** *** * * * ** ***

*** * * ** *** ** * * **** =(10-(sum%10));

* * ** ** * * * ** == s13)
    {
** ** **** ** *** * ** ** ** ********* * * ** ISBN");
    }

* * *** ** * * ** * * **
    {
*** * * * * *** ** * *** * ** * ISBN");
    }

* *** **** * * * ** ** ** * ** *** * ** *** 0;
    }
最新回答 用戶: (-193 分)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
    #include <stdio.h>
#include <conio.h>

int main()
{

* ** ** * *** * * * * ** isbn;
*** * ** * * * * s1;
*** ***** * * * * * s2;
* *** ** ** * * ****** s3;
* * ******* * * * * * s4;
* *** * * **** * *** s5;
* * *** * ** * ** **** ** ** s6;
** * **** * ***** ** * * s7;
* ***** * *** *** *** * ** s8;
* ** * ** * **** * **** s9;
*** ** ** ** ***** * ** ** s10;
* *** * * **** ** ***** s11;
***** * * ** * ** ** *** * ** s12;
* * ** **** ******* s13;
* ** ** *** * check;
    int sum;

****** * ** * **** *** ** *** ** * &isbn);

*** *** *** ** * ***** **** * ****
* * * ** ** *** ** * * *
**** * * ** * * ** * * **** *** * * * *
* * **** *** *** * * ** * * ** ****** * * *
* *** **** * ** * **** ** * ***** *
* * * * ***** ***** * ** * *** * * *
**** **** * *** ** ** * *** * * * *** * ***
*** * ** *** * ** * ****** ** * ** * * ***
* * * ** ** * * * *** * ***** * * *** *
*** * * * * ** *** * ** * *** *** *
* * * * * ** **** * * ** * * ***
* ** *** **** * * *** ** ** * *
** * * ** *** * * ** * *

* * * * ** *** ** * **** ***** * * * ** * *

** ** * * *** *** * ** ** ******

** * * * ********* ** ** * * == s13)
    {
***** ** * * * *** **** *** **** * * * ** ** * * * * ISBN");
    }

* * ** * ** **** ***
    {
** ** * * ** **** * * * * * * ** * * *** ISBN");
    }

** ** * **** ***** * * * ** ** ** ** 0;
    }
最新回答 用戶: (-193 分)
0 0
prog.c:2:19: fatal error: conio.h: No such file or directory
 #include <conio.h>
                   ^
compilation terminated.
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>
int main(void)
{
    int n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,sum,check;
** * ***** * *** ** * ** ** *** * **** * ** * * ** **** * ** ** ** * ** * * ** * * ** * **** ** ** * *** **** ** *** *** * * ** * * *

* ** * ** ** *** *** *** **** ** ** * ***
* * ** * * * *** ** * ** ** * *

* * * *** *** *** *
    {
* * * *** *** ** * ** * **** * * * ** * *** *
    }

* * * * * * * * ** * *** * * * * **** ****
* ** ** ***** * ***** ** * ***** ** * **
** * * ** ***** * * * **** *** * * ** ** * * * ** * * *** ** ***** ** * ISBN");
** * *** *** * * ** **** * ** ** * ** *
**** ** ** ** ** **** *** * * * **** ** ***
* * * * **** ****** **** ** * **
*** ** ** **** ******** * *** * * ** * ** * *** ** ****** * * * ******* * * * ** ISBN");
* ** * *** * ** * * ** * **** * * * ** *
return 0;

}
最新回答 用戶: (-249 分)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Correct output
Case 3: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.178.21
©2016-2025

相關問題

0 喜歡 0 不喜歡
26 回答
[考試] 最新提問 12月 9, 2017 分類:Midterm | 用戶: thopd (12.1k 分)
ID: 36751 - 從幾時開始: 2017-11-15 14:10 - 到幾時結束: 無限制
| 4.3k 瀏覽
2 喜歡 0 不喜歡
77 回答
[練習] Coding (C) - 最新提問 10月 19, 2017 分類:Chapter 5: Selection Statements | 用戶: thopd (12.1k 分)
ID: 27667 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 11.1k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶