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
Which of the following sentences is accurate? a. PDF stands for "Proofreading Direct Files." b. PDF files cannot be edited. c. B
olga_2 [115]

Answer: Option (c) is correct

Explanation:

PDF is portable document format that come in form of file format .It is used for sharing and transmitting between computing and operating systems for viewing and printing in actual page layout. They can be used fro eBooks ,scanned document and text etc.

  • Other options are incorrect because not all business organization use PDF, PDF has the capability of being edited and it stands for "portable document format".
  • Thus, the correct option is option(c)
8 0
3 years ago
In which of these areas can software engineers specialize?
Elza [17]

Answer:

as me I choose managing user programs.

Explanation:

4 0
3 years ago
A variable that can have values only in the range 0 to 65535 is a :
Thepotemich [5.8K]

Answer:

a.

Explanation:

Two bytes have 2 times 8 bits is 16 bits.

Max value that can be expressed is 2¹⁶-1 = 65535

6 0
3 years ago
The ____, or typeface, defines the appearance and shape of letters, numbers, and special characters.
Paladinen [302]
Font(s)
fonts is another word for typeface
the appearance of letters and numbers when you chang the font
5 0
3 years ago
Purpose for a Phone....?
jeka94
Used to talk to people, chat with people on mobile.
5 0
3 years ago
Read 2 more answers
Other questions:
  • OSHA requires that employers pay for most required personal protective equipment (PPE), including: A. Hard hats B. Logging boots
    5·1 answer
  • What runs a network, steering information between computers and managing security and users?
    11·1 answer
  • Which payment type is best if you are trying to sick to a budget?
    15·1 answer
  • This is not homework but how do you fix this I’ve tried everything
    9·1 answer
  • What is the most likely cause of a print job rendering the wrong colors on the output?
    14·1 answer
  • Free points,
    15·2 answers
  • Which of the following is not a bus type A. Address bus B. Data bus C. Memory bus D. Control bus ​
    7·2 answers
  • A user calls to complain that her computer is behaving erratically. Some days it functions correctly, and other days, it crashes
    15·1 answer
  • From the time users first visit a new website, or view a new media piece, how much time will they spend on the site before they
    10·1 answer
  • When passing a list of parameters to a stored procedure by name, you can omit optional parameters by:
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!