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
marin [14]
3 years ago
10

Write a program to input a number.Find the sum of digits and number of digits

Computers and Technology
2 answers:
BaLLatris [955]3 years ago
8 0

Answer:

<em>#Sum of Digits</em>

a = int(input("Enter a number: "))

sumofdigits = sum(int(dig) for dig in str(number))  

print("Sum of digits: ", sumofdigits)

<em># Number of digits</em>

count = 0  

print ("Total number of digits : ",len(str(abs(a))))

Explanation:

It is pretty self-explanatory however, I will tell it to you anyways. So, the sum of digits iterates to each digit and adds them up. For the number of digits, it uses in-built functions (length, string and absolute)

ki77a [65]3 years ago
7 0

omg a computer program

i love it

okay so i will assume taht you want the program to be in python

here we go

a = int(input("Enter a number ")

b = int(input("Enter another number ")

sum = a + b

def Digits(sum):

count = 0

while sum != 0:

sum //= 0

count += 1

return count

print(f"Sum is {sum} \nnumber of digits are {Digits(sum)}")

You might be interested in
After merging two arrays is complete you need to
VikaD [51]

Answer: C) copy the merged array back to the original array

Explanation:

 After performing merging of two array then, copy the merge array back to its original array. Merging of two array is done by the process of merge sort. Merging of two array is the similar process of concatenate the two array into the single object.

It basically works on the principle of divide and conquer algorithm. It divide the input value into the two half and then, sorted the accordingly. Then after completion of merging the two array it copy into the original array.

5 0
3 years ago
Let S be an NP-complete problem and Q and R be two other problems not known to be in NP. Q is polynomial time reducible to S and
levacccp [35]

Answer:

B. R is NP Hard

Explanation:

Given:

S is an NP complete problem

Q is not known to be in NP

R is not known to be in NP

Q is polynomial times reducible to S

S is polynomial times reducible to R  

Solution:

NP complete problem has to be in both NP and NP-hard. A problem is NP hard if all problems in NP are polynomial time reducible to it.

Option B is correct because as given in the question S is an NP complete problem and S is polynomial times reducible to R.

Option A is not correct because R is not known to be in NP

Option C is not correct because Q is also not known to be in NP

Option D is not correct because Q because no NP-complete problem is polynomial time reducible to Q.

5 0
3 years ago
Saving a file as a new filename can be accomplished through the Save As dialog box.
Arisa [49]

Answer:

True.

Explanation:

A dialog box is a small window that serves as a controlling element in computers. The name dialog box is suggestive that it is a window that helps the user to communicate and response with an answer.

There are several types of common dialog box such as open dialog box, save as dialog box, print dialog box, etc.

Save as dialog box is a window that enables the user to save a file with a new name and new location. Save as dialog box can be opened by going to the File menu and click Save as. After the Save as dialog box appears, the user is able to change file name, location, etc.

Thus the statement is true.

4 0
4 years ago
What may happen if a large number of computer users are trying to access a web site at the same time as you ?
Ber [7]
It Will Say " Too Many People At A Time Trying To Get In " And It Will Say Wait .
6 0
3 years ago
Interactive sites where users write about personal topics and comment to a threaded discussion are called A. networking sites. B
Viefleur [7K]

The answer is definitely C: Blogs.

Blog is somewhat very similar to a website. It is sort of a journal that is mostly maintained by one person, the blogger. They are updated regularly and can contain information related to a specific topic. In most cases, blogs are used as dairy diaries about politics, people’s personal lives, or social commentaries. They give you, as a blogger, opportunities to interact with your visitors while promoting your products.

3 0
4 years ago
Read 2 more answers
Other questions:
  • Where would be the most likely place to find the keyboard combination used to toggle a keyboard backlight on or off?
    8·1 answer
  • Makes it possible to distribute both power and data using ethernet cabling. select one:
    12·1 answer
  • What are availabilities and uses of solar energy/panels? (please explain as much as you can)
    8·1 answer
  • 50 POINTS PLEASE HELP MEEEEEEEEE!!!!!!
    6·2 answers
  • A special symbol that is used as an underlining structure to an agenda
    5·1 answer
  • An organization's IRP prioritizes containment over eradication. An incident has been discovered where an attacker outside of the
    14·1 answer
  • What is a programming language?
    11·2 answers
  • 2. What does the "Users" metric measure?
    10·1 answer
  • What is the purpose of HTML?
    7·1 answer
  • What is a current trend in ERP systems?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!