Computer Science, asked by raju46963, 5 months ago

write a python program to find the sum of digits of a given number​

Answers

Answered by Boookworm
3

Below are the methods to sum of the digits.

Below are the methods to sum of the digits. Method-1: Using str() and int() methods.: The str() method is used to convert the number to string. The int() method is used to convert the string digit to an integer.

Below are the methods to sum of the digits. Method-1: Using str() and int() methods.: The str() method is used to convert the number to string. The int() method is used to convert the string digit to an integer. Convert the number to string and iterate over each digit in the string and after conerting each digit to integer and add to the sum of the digits in each iteration.

(っ◔◡◔)っ Mark brainliest please

Attachments:
Answered by keyboardavro
5

Answer:

Below are the methods to sum of the digits. Method-1: Using str() and int() methods.: The str() method is used to convert the number to string. The int() method is used to convert the string digit to an integer. Convert the number to string and iterate over each digit in the string and after conerting each digit to integer and add to the sum of the digits in each iteration.

Explanation:

Attachments:
Similar questions