Computer Science, asked by jappanmehta22410001, 9 months ago

write an program to print the sum of three digit numbers in C

Answers

Answered by arulagalya123
1

Answer:

# Python 3 program to

# compute sum of digits in

# number.

# Function to get sum of digits

def getSum(n):

sum = 0

while (n != 0):

sum = sum + int(n % 10)

n = int(n/10)

return sum

n = 687

print(getSum(n))

Answered by ekam84
1

Answer:

C program to accept a three digit number print the sum of individual digit of given number=

  • main ( )
  • {
  • int a,b,c, n, sum;
  • clrscr ( ) ;
  • scanf("%d", & n) ;
  • printf ("Enter Three digit Number:") ;
  • getch ( ) ;
  • }

hope it will help you

Similar questions