Ask Question
19 November, 10:22

Largest. Write an algorithm that read 5 distinct integers and displays the largest value. Assume the input values are distinct integers. ISBN. 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 in the following manner: Multiply the first digit by 10, the second by 9, the third by 8, and so on, down to the ninth digit by 2. Add the values together. Divide the sum by 11. What is the remainder

+5
Answers (1)
  1. 19 November, 11:20
    0
    Largest Number Algorithm

    Input n1, n2, n3, b4, n5

    if n1>=n2 and n1>=n3 and n1>=n4 and n1>=n5

    Print n1 + "is the largest"

    else if n2>=n1 and n2>=n3 and n2>=n4 and n2>=n5

    Print n2 + "is the largest"

    else n3>=n1 and n3>=n2 and n3>=n4 and n3>=n5

    Print n3 + "is the largest"

    else n4>=n1 and n4>=n2 and n4>=n3 and n4>=n5

    Print n4 + "is the largest"

    else

    Print n5 + "is the largest"

    End if

    End

    The remainder of a valid ISBN number is 0

    ISBN Algorithm

    input isbnnum

    Length = Length (isbnnum)

    if Length! = 10 then

    return false;

    end if

    Checksum = 0

    kounter = 0

    do

    Num = isbnnum[kounter] - '0'

    if 0 > Num or 9 < Num then

    return false

    end if

    Checksum = Checksum + (Num * (10 - kounter))

    kounter = kounter + 1

    while (kounter < 9)

    lastnum = isbnnum[9]

    if lastnum! = 'X' and (lastnum '9') then

    return false;

    end if

    if lastnum = = 'X' then

    Checksum = Checksum + 10

    else

    Checksum = Checksum + (lastnum - '0')

    end if

    if Checksum % 11 = = 0 then

    Print "Checksum is "

    Print Checksum

    Print "Remainder is"

    Print Checksum % 11

    Step-by-step explanation:

    The first algorithm determines the largest of 5 numbers

    It first accepts input for 5 numbers named n1 to n5

    Then it checks one after the other, the largest of the 5 numbers

    The second algorithm determines an ISBN Number

    1 : This line takes input for ISBN number in variable isbnnum

    2 : This line computes the length of variable isbnnum

    3: This line checks if the length of the isbnnum is equal to 10

    4: If the length is not equal to 10, the algorithm stops execution

    6,7: These lines initialise the variable checksum and kounter to 0

    8 to 15: These lines compute the checksum using an iterative do loop statement

    16: This line saves the last character of variable isbnnum to variable lastnu

    17,18,19: These lines checks is lastnum is not X and it is not a number, the algorithm is stops execution of true

    20 to 24: These lines add or remove the last character from the checksum

    25 to 27: These lines check if the checksum can be divided by 11. If yes, the checksum is printed

    28,29: These lines print the remainder, which is 0.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Largest. Write an algorithm that read 5 distinct integers and displays the largest value. Assume the input values are distinct integers. ...” in 📘 Mathematics if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers