answersLogoWhite

0

How do you sum a number's all digit using for loop?

Updated: 8/19/2019
User Avatar

Wiki User

13y ago

Best Answer

Using for loop we can find sum of digits of a number.

Inside the loop just perform

Logic Expression 1) rem=num%10. {To find the unit place no. using remainder functon}

2) sum = sum+rem {to find the addition ie output}

3) num=num/10 {to eliminate the added digit}

Just repeat these steps in the loop.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you sum a number's all digit using for loop?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Largest 5 digit number using all even numbers?

88,888


How many 17 digit numbers are there using 0-9?

The possibilities are all the counting numbers from the largest 16-digit one to the largest 17-digit one.99,999,999,999,999,999 minus 9,999,999,999,999,999 = 90,000,000,000,000,000


How do 3 digit numbers compare to 4 digit numbers?

3 digit numbers are lessthan 4 digit numbers


How many four digit numbers can be formed using 3 only once but 3 must be used in all such numbers?

1


Using all digits 1230 without repeating any digit how many four- digit numbers can you write?

18, if leading 0s are disallowed.


Can you list all the 4 digit numbers using 1234?

Nope, look at 1000, this is a 4 digit number and we can't list it with 1,2,3, and 4


What is a fraction that has 6 numbers?

There are 99999 fractions with a 1-digit numerator and 5-digit denominator - 6 digits in all: though not all the fractions are different. Similarly there are 8,999,910 fractions with a 2-digit numerator and 4-digit denominator. And so on. In total, there are 3,600,009 fractions using 6 numbers.


What is the ratio of 1 digit numbers to 2 digit numbers?

There is no such ratio that applies for all single-digit and double-digit integers.


How many four digit numbers can be formed using all digits if same digit on four place is not allowed example 5555 is not allowed?

Total possible 4-digit numbers= 1000, 1001,...,9999 = 9000 Total with same digit numbers = 1111,2222,...,9999 = 9 9000 - 9 = 8991


What are all possible three digit numbers using numbers 0-1-2-3-4-5-6-7-8-9?

Total number of possible 3-digit numbers = 9!x10!10!


What are all of the numbers that are odd three digit numbers with a digit sum of 3?

111 and 201


What is the largest six digit number you can write using the numbers 381724?

874321 is the largest number made from all these digits.