answersLogoWhite

0

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

14y ago

What else can I help you with?

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


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.


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 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


1234567890 are what kinds of numbers?

They are all single digit numbers.


How do you print numbers as even numbers in a loop in qbasic?

To print even numbers in a loop in QBasic, you can use a FOR loop to iterate through a range of numbers and check if each number is even. An even number can be identified using the modulus operator (MOD). Here's a simple example: FOR i = 1 TO 20 IF i MOD 2 = 0 THEN PRINT i END IF NEXT i This code will print all even numbers from 1 to 20.