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
The prediction that the number of transistors on a chip would double about every two years is known as ________. Metcalfe's law
MaRussiya [10]

Answer:

Moore's law

Explanation:

The Moore’s law which was named after the pioneer, Gordon Moore, predicted that the number of transistors on a chip would double about every two years. This law is one of the reasons why computers became so powerful. These transistors and chips are used to make mathematical calculations and in 1965, Gordon made an observation and forecasted that the number of transistors that can be placed in any ICs doubles approximately every two years. Moore was so convinced about this prediction that he went on to co-found the biggest chips processor; INTEL. This trend has been accurate since then but has started to slow down from 2013.

5 0
2 years ago
Consider the clipping of a line segment in two dimensions against a rectangular clipping window. Show that you require only the
Semmy [17]

Answer / Explanation:

Assuming we define the end points as ( x₁ , y₁) and (x₂ , y₂) and the rectangular window edge as ( Xmin ,Ymin and Xmax , Ymax)

The illustration of the above assumption is represented in the diagram below.

Now, suppose the line segment is between the points P₁ = ( x₁ , y₁) , and

P₂ = (x₂ , y₂).

We can then create a line recalling and using parametric form,

P(t) = ( 1 - t) P₁ + tP₂ , t ∈ {0 , 1 },

So, for the X axis, we have,

tₓ = P₁ₓ - x ÷ P₁ₓ - P₂ₓ

We need to note that at this point we need to know the minimum and maximum unclipped  values for parameter t from each dimension.

Therefore,

- ( tmin , tmax ) = ( 0,1) means unclipped line

-tmin > tmax means completely clipped out line

– Some other range means partially clipped out line.

6 0
3 years ago
What is the most commonly used tab in the Filter dialog box?
aleksandrvk [35]

The answer is Messages

3 0
3 years ago
Read 2 more answers
Writing anything that comes to mind that may relate to your personal essay is called:
sammy [17]
My life career in computer science
7 0
3 years ago
Read 2 more answers
What policy definition can help remind employees in the User Domain about what constitutes suitable use and improper use of corp
Helga [31]

Answer:

so so sorry I don't know

Explanation:

hope fully you'll get the answer

4 0
3 years ago
Other questions:
  • In this story, the reader is strongly encouraged to believe that Skidmore is guilty of poisoning his brother Manchester. Explain
    6·1 answer
  • When choosing a new computer to buy, you need to be aware of what operating it uses.
    12·1 answer
  • The Status bar is used to control the majority of the drafting settings in AutoCAD
    13·1 answer
  • People are able to predict future events to some extent because: (Select all that apply)
    11·1 answer
  • Select the statements that are true regarding the future of technology. Select 2 options.
    12·1 answer
  • Think about some of the most memorable and forgettable games ever created. They can be games that were discussed in this unit or
    10·1 answer
  • Which term describes a visual object such as a picture a table or text box
    15·2 answers
  • Why is computer economics important?​
    10·1 answer
  • If userNum1 is less than 0, put "userNum1 is negative.\n" to output. If userNum2 is greater than 10, assign userNum2 with 0. Els
    12·1 answer
  • identify the difficulties with the k-nearest neighbor algorithm. a. both a and b b. calculate the distance of the test case from
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!