0

Sum of digits, pls help

How can I find (and print) all numbers less than n whose sum of digits equals 10? User inputs n and n must be bigger than 100. Thank you

17th Nov 2017, 10:34 PM
Rafaela Petričević
Rafaela Petričević - avatar
5 Antworten
+ 1
Isn't that just multiples of 10 though? I've done this... https://code.sololearn.com/cUVSQe90ktAb/?ref=app
18th Nov 2017, 10:20 AM
Max S
0
n=input("enter a number") tot=0 if n>100: while(n>0): dig=n%10 tot=tot+dig n=n//10 if tot==10: print tot else: print "not equal to ten" else: print "enter number greater then 100" if still problem persist you can mail me
18th Nov 2017, 5:54 AM
varun agarwal
varun agarwal - avatar
0
Yes Max, but I must do it without converting to string Thank you both
18th Nov 2017, 11:03 AM
Rafaela Petričević
Rafaela Petričević - avatar
0
Why?
18th Nov 2017, 7:33 PM
Max S
0
My professor said that 😏
18th Nov 2017, 7:35 PM
Rafaela Petričević
Rafaela Petričević - avatar