1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
riadik2000 [5.3K]
2 years ago
11

write a program that computes an integer's checksum. to compute the checksum, break the integer into its constituent

Computers and Technology
1 answer:
Serggg [28]2 years ago
8 0

Using the knowledge in computational language in python it is possible to write a code that computes an integer's checksum.

<h3>Writting the code:</h3>

<em>def checkSum(n):                    # Function definition</em>

<em>    total = 0                       # total variable which returns sum</em>

<em>    c = 0                           # counter variable which count the even position</em>

<em>    while(n!=0):                    # running a loop while n != 0</em>

<em>        r = int(n%10)               #breaking the number into digits</em>

<em>        c=c+1                       # increase counter</em>

<em>        if c%2==0:                  # if counter is even position then double the number </em>

<em>            r = r*2</em>

<em>            while(r!=0):                            # do the process</em>

<em>                total = total + int(r%10)</em>

<em>                r = int(r/10)</em>

<em>            n=int(n/10)    </em>

<em>        else:                       # if counter is odd position then simple add the digit </em>

<em>            total = total + r       # into total</em>

<em>            n=int(n/10)</em>

<em>    return total                    # in the last return the sum of digits</em>

<em># Driver code</em>

<em>n = int(input("Enter Number:"))         # asking user to enter the number </em>

<em>print(checkSum(n))                      # calling the function</em>

See more about python at brainly.com/question/18502436

#SPJ1

You might be interested in
George wants to pursue a career in web technology as a web developer. Which certifications can help him as a web developer?
skelet666 [1.2K]

Answer:Google Analytics IQ.

he can use this

Explanation:

3 0
3 years ago
The website’s________ section will enable Lana to add her company website name and logo to the top of every page of the website.
Delicious77 [7]

It is the header section of the website.

5 0
3 years ago
Create a function that takes a list of numbers between 1 and 10 (excluding one number)
Luda [366]

def missing_num(lst):

   for n in range(1,11):

       if n not in lst:

           print(n)

lst = (1,3,4,5,6,7,8,9,10)

missing_num(lst)

I hope this helps!

8 0
3 years ago
When an input file is opened, the read position is initially set to the first item in the file. question 13 options:
Rom4ik [11]
<span>A special value inside of an INPUT file that marks the position of the location of the next item that will be read from the file. When opened, the READ POSITION is initially set to the first item in the file, thus the Answer is True.</span>
4 0
3 years ago
Subjective information is sometimes helpful in decision making. <br> a. True b. False
pshichka [43]

Answer:

a-true

Explanation:

you find that you not certain about what you want so I suggest you find information on that certain subject

3 0
3 years ago
Read 2 more answers
Other questions:
  • Drivers must always yield to emergency vehicles traveling
    9·1 answer
  • Write an overloaded constructor for the Table class that will take a single argument for the color of the table Write a set meth
    13·1 answer
  • Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print "Too small". If greater than
    15·1 answer
  • What is a characteristic of high-level computer programming languages?
    8·1 answer
  • If more than one symbol is located immediately adjacent to another, it usually means that a multi gang box for multiple wiring d
    12·1 answer
  • Why does the phrase "compatibility mode” appear when opening a workbook?
    6·2 answers
  • When an Item is base lined, it becomes frozen, here frozenmeans that only creating an old version can change the item
    9·1 answer
  • Complete the below method, isPalindrome(), that takes in a String and returns a boolean. The boolean should be true if the Strin
    7·1 answer
  • Would a hurricane form if the humidity is really high and the breeze is very low
    11·1 answer
  • Luis saves an attachment that he received from Kevin. Where will the attachment save by default?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!