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]
1 year 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]1 year 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
If you could represent yourself with one object from your home what would it be ?
user100 [1]

Answer:

cross

bc im religous and stuff (0_0)

8 0
2 years ago
Read 2 more answers
Please help. will give u brainliest!! khan academy computers and the internet!!
Oxana [17]

Answer:

a or c

Explanation:

think of which answer seems illogical.

5 0
3 years ago
What is the term used for describing the judgement or common sense part of problem solving​
Triss [41]

Answer:

Explanation:

Heuristic

6 0
3 years ago
OSHA requires training for employees on the hazards to which they will be exposed.
Sedaia [141]

A, OSHA does require training for employees on the hazards to which they will be exposed.


3 0
3 years ago
Read 2 more answers
How to take a key off a keyboard without breaking it?
klio [65]
You can carfully wedge something in between the key and gently pull up 
4 0
3 years ago
Other questions:
  • This measures how close a biometric reading is to a prerecorded template
    11·1 answer
  • PLEASE HELP ASAP!!!
    8·1 answer
  • How many Iron molecules are in the compound Fe4O2?
    15·2 answers
  • Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 te
    13·1 answer
  • True or False
    11·1 answer
  • 7. A patent is an example of a rare and valuable resource. Indicate whether the statement is true or false and also justify it.
    14·1 answer
  • Xercise 1<br>1.<br>What is system? Explain the components of system in brief.​
    12·1 answer
  • How does the internet help you to improve your:
    15·2 answers
  • Choose all of the items that represent functions of an operating system.
    11·1 answer
  • Would it be feasible to combine fixed length field and variable length field format in single disk
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!