Question: convert from paython to c program #C not c++ Solution: # Python program to calculate checksum of ISBN number ISBN_12string = input( Enter the first

convert from paython to c program #C not c++

Solution:

# Python program to calculate checksum of ISBN number ISBN_12string = input(" Enter the first 12 digits of an ISBN-13 as a string: ")

#ISBN_12number = int(ISBN_12digit)

checksum = 0 var = [0,0,0,0,0,0,0,0,0,0,0,0] i=0

for ch in ISBN_12string: var[i] = int(ch) i = i + 1 checksum = 10-(var[0] + 3*var[1] + var[2] + 3*var[3] + var[4] + 3*var[5] + var[6] + 3*var[7] + var[8] + 3*var[9] + var[10] + 3*var[11] )

checksum = checksum % 10

if checksum == 10: checksum = 0

print('The ISBN-13 number is {0}{1}'.format(ISBN_12string, checksum))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!