Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

c programing find isbn programm The 13-digit International Standard Book Number

ID: 3771564 • Letter: C

Question

c programing find isbn programm

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. For example, assume that the first twelve digits are 978960931961. (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 The check digit = 10 - (126 % 10) = 10 - 6 = 4 Write a program that reads a 13-digit ISBN and checks the last digit to see if it is valid or not.

Explanation / Answer

#include<stdio.h>
int main(){
long long isbn,temp;
printf("Enter the ISBN : ");
scanf("%lli",&isbn);
printf(" Entered ISBN is %lli ",isbn);
int i,sum=0;
temp = isbn;
temp = temp/10;
for(i=0;i<6;i++){
sum+=(temp%10)*3;
temp=temp/10;
sum+=temp%10;
temp=temp/10;
}
int c = 10 - (sum%10);
if(c==isbn%10)
printf("ISBN is valid");
else
printf("ISBN is invalid");
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote