The solution to the above question is given below with screenshot of output.
=====================================================
I kept the logic simple and i have tested all outputs.
If there is anything else do let me know in comments.
=====================================================
============ CODE TO COPY ===============================
#include<iostream> using namespace std; // Checking if number is valid of not bool is_valid( long int isbn_no ){ // if number if greater than 9 digits or negative it's invalid if ( isbn_no > 999999999 || isbn_no < 0 ) return false; // number if ok return true; } int calculate_check( long int isbn_no ){ int sum = 0; int digits = 0; long int temp = isbn_no; // count the number of digits in number while ( temp != 0 && ++digits ) temp = temp/10; // multiply all number as per the given algo for ( int i = 9 ; i >= 10 - digits; i-- ){ int rem = isbn_no % 10; isbn_no = isbn_no / 10; sum += rem*i; } // return sum modulo 11 return sum % 11; } int main() { long int isbn_no = 0 ; int checksum = 0 ; cout << "Please Enter First 9 Digits Of ISBN Number : "; cin >> isbn_no; if ( is_valid( isbn_no ) == false ) { cout << "Invalid Isbn number " << endl; return 0; } // here we are caclulating checksum checksum = calculate_check( isbn_no ); cout << "Checksum is : " << checksum << endl; return 0; }
=====================================================
Output
Using c++ A ten diglt ISBN number uses a checksum as its last diglt to verlfy...
Introduction: Ten digit ISBN numbers are created so that the first nine digits are information digits and the last digit is a check digit. T his last number helps people notice and correct mistakes that might be made in recording the information digits. The same is true for thirteen digit ISBN numbers. Here is a ten digit ISBN number: 0-13-149498-8. The digit 0 indicates the book is written for English-speaking people. The number 13 and the number 149498 identify the...
Description: An ISBN-10 (International Standard Book Number) consists of 10 digits: didzdzdad5d6d7d8d9d1o. The last digit, dio, is a checksum, which is calculated from the other nine digits using the following formula: (d, x 1 + d2 x 2 +d3 x 3 + da x4 + ds x 5 + de x 6 + d7 x 7+ d3 x 8+dex 9) % 11 If the checksum is 10, the last digit is denoted as X according to the ISBN-10 convention. Write...
Write a C++ program that will read in an ISBN-10 ID, and determines whether the tenth digit is the valid checksum of the first nine digits. The program reads in purported ID, and finishes execution once it has printed out what it's read in, plus either VALID or INVALID. Cannot use getline function. a) Processing stops after ten digits, even if there are more digits on the line of input. The
Write a program in Python that asks the user for the ISBN of the book in the format xxx-x-xxx-xxxxx-x. To validate: Initialize a total to 0 Have the program remove the dashes so that only the 13 digits are left in the ISBN string for each index of the first 12 digits in the 13 digit ISBN string get the digit at the current index as an integer If the current index is an even number, add the digit to...
In Python: Write a well-documented (commented) program that asks the user for a 9-digit integer, computes its checksum, and then prints the corresponding ISBN number. The International Standard Book Number (ISBN) is a 10-digit code that uniquely specifies a book. The rightmost digit is a checksum digit that can be uniquely determined from the other 9 digits, from the condition that d1 + 2d2 +3d3 + ... + 10d10 must be a multiple of 11 (here di denotes the ith...
In Python Write a well-documented (commented) program that asks the user for a 9-digit integer, computes its checksum, and then prints the corresponding ISBN number. The International Standard Book Number (ISBN) is a 10-digit code that uniquely specifies a book. The rightmost digit is a checksum digit that can be uniquely determined from the other 9 digits, from the condition that d1 + 2d2 +3d3 + ... + 10d10 must be a multiple of 11 (here di denotes the ith...
IN PYTHON ''' Helper func 3: checksum_ISBN Input: a list with 9 single digit number in it (first 9 digit in ISBN) Output: print out: "The correct checksum digit is:__. Now we have a legit ISBN: _____" Hint: just loop through 0-9, test every one with helper func1 to find out the one checksum that forms a legit ISBN with the correct ISBN in lis (10 numbers), call helper func2 to format it correctly. Then print the final result. '''...
Please tell me whether my answers are correct or not. If not please tell me why and give me a guide to solving the problem correctly. Thanks! 3 Check Digits: ISBN In this problem, we'll look at a real-world applications of check-digits International Standard Book Numbers (ISBNS) are 10-digit codes (did2...dio) which are assigned by the publisher. These 10 digits contain information about the language, the publisher, and the number assigned to the book by the publisher. Additionally, the last...
Program Instructions: Write a C++ program that uses a random number generator to generate a two digit positive integer and allows the user to perform one or more of the following operations: Double the number. Reverse the digits of the number. Raise the number to the power of 2, 3, or 4. Sum the digits of the number. If the number is a two digit number, then raise the first digit to the power of the second digit. If the...
c++ pleased Assignment 6a (15 points] - Character and String related processing... Listed below are two interesting programming challenges that will require a bit of character and/or string related processing with functions. (Carefully read the specifications for each programming challenge and select ONE.) (1) Sum of Digits in a String Write a program that asks the user to enter a series of single-digit numbers with nothing separating them. Read the input as a C-string or a string object. The program...