0 like 0 dislike

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.

(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

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.

#Try 1:

Input:

``9789609319614``

Output:

``Valid ISBN``

#Try 2:

Input:

``9781482214505``

Output:

``Valid ISBN``

#Try 3:

Input:

``9780132936493``

Output:

``Invalid ISBN``

[Exam] asked in Midterm | 253 views

0 like 0 dislike
`Hidden content!#include<stdio.h>int main(void){ ****  ** * * ****  **  a,b,c,d,e,f,g,h,i,j,k,l,m; ** ** *****    ***   ****   * *    * *  *    *  * *      ***** ** *** ** **   **  * * * ****  *  ******  *   *      *****  * *   ***   * *  **  * *** * *       **** *** * *   *  * *    check,sum;* **  * **   *    **** ***** * *  *** ** ***** **** * ** ******* *** * * **   **  *   **     **    *** * ***** * *    *** **** **   ***  **  *   **   *      ********* * ******** ***   *   *  **   * ** **** *    }*** **     *  *   *  * *  if(check != m) *  * *  ** * **  ** ** **  *  *  **** *** ***   **   **  *** ** * **  ***  ****     *     * ********* ISBN"); * **     ***    *   ** * ***** ** *  ***  **** *  *   *   *  *  * ***      ** * *  *     * *** *****  ***** ** *   ** *   * *  * **    * * **  ISBN");* ****** ** ** *   *   **  }`
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
`Hidden content!#include<stdio.h>int main(void){ *   *****  ** **  * ** *** *  a,b,c,d,e,f,g,h,i,j,k,l,m; * **  *   * ** ** ****  ***  **   *  * *    *    *  * ****     ******** ****** *  * **** * * * *  ***  *  * *****  * **  **  ** * *****     *     **    **    *   *   **   *  *    *   **  **    check,sum;  **   **  ****  *   *    **  *  *  ** *   **     *  ** **  **  *****   ***   *     *  ****     * ***     * *  *   *** *   * ** * ** * != m)* *****  * *** *   * ** ** * *  **     *  * *  * *  * **      *  **** * *****   **** *  ** ** **** ISBN"); ***** * ****  **    * ** * ** *****  **     * ***     *    *  *    *     ******* *  *** * *   ** **   *  * **  ** * ***     ***   *** * * * ISBN");  * ** *  *  * *    * *** * *}`
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
`Hidden content! *   **  *  * ** **  ***   ** * *  *  *   *  int main(){ ** *  ***  *   *  *  ** * **   **   ****   a noob.\nI forgot  ***     ** *    *   *  * *  *   **  * *  **  0;}`
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
`Hidden content!* **** ** * *       * int main(){int *    **   *** ***  *      ** * *   * * * * ***      *    ***** *  ********        * *    * *   *** *** *****  * **** *   ** **  *** * * ** * * *  * * **   **   * * * ****  * * ** ** *  * * ***** ****   ******* ** * **  ***** ****    *check=10-sum%10;***  **   **** * * *    ISBN");else   * *  * **   **** ISBN");return 0;}`
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
`Hidden content!#include<stdio.h>int main(){* ****   *   **  ****  **  ***  a[13],i,j;*****   * ***  *  *   **   *   **  *  * ** * *  *   *** * *** *   * * ** **  *   *     **  ** * *      **  **     * * * *   * **  * *   **** **    **     }*******  **  ***  ***   * * ** * ** *       **     ***  * **** ** ****   **** *** *     *   *    ** ***  * * * * **       {*   *    ***** * ** *  * ****   **      *   ** * * ** *** * *** *** ISBN"); **** *   *   ****    *  ***    *  *     *   *****   ***** ***  * ** *    * * ** ****  *   ****    ***  *  *  * ***** *** *** * **** * *** * * * * **** *** **** ISBN"); **   ****** ** *       *** *** *}`
`Hidden content!#include <stdio.h>#include <stdlib.h>int main(){***    **   **  **    ***  a,b,c,d,e,f,g,h,i,j,k,l,m,sum=0,check=0;   *    *  * *** *  *      *  *   **     * ****         * * ****** ****** **    *    *** ******   ** ** **    *     **  * * **     * *  *****   **** ** ***  *    **     ***   * *  *** *** * **     *****   **  *   * ** **** ****   ***  * **  * * * ***** * *  * **      * ****  **  (check==m)*** **  **    *   *    ****  ***  **  * ** **   *** *   *  *   **    ISBN");* ***  *   * *  *  * ***   *   * *   *  * **  **    * * * **  * * * *  *   **  * *  *** ** ***  * * ***  ISBN");  *  * *  * **   **   ** ***  ** 0;}`