Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5
Try and try but don't fail to try. Here comes my approach. https://code.sololearn.com/cgSMw331od3O/?ref=app
6th May 2021, 3:09 PM
MrMysterious5
+ 2
show your attempt I ain't gonna steal it cuz i already done this. edit: can you guys stop posting codes now? it's already answered now.
6th May 2021, 2:26 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
where will the loop conditions are applying in the loop ??
6th May 2021, 10:48 PM
Saad Arif
0
YUGRAJ ✧ιη∂ιαη ησвιтα✧ where's the declaration of 'n' variable? you obviously need to put it in the code. edit: i got it
6th May 2021, 2:40 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
0
Coding kitty it's just the way to write or algorithm. -_-
6th May 2021, 2:41 PM
YUGRAJ
0
Best of Sport It seems your question appears to be an assignment. Please show us your attempt and use the 8 rules to get help from the community. https://www.sololearn.com/Blog/38/8-simple-rules-to-get-help-from-the-community *can be a code coach solution which is meant for you to do to help you establish your skills abilities and where you need to learn... not the community *one issued by a school or other institution *one issued or created by another platform *one that appears to be in the form of a challenge that was created by you or somewhere else. Your question has been reviewed and will be marked for deletion. https://www.sololearn.com/Discuss/1316935/?ref=app
8th May 2021, 5:00 AM
BroFar
BroFar - avatar
- 1
Using array concept to put in the arrays Example in java Int ch[]={5,2,3,9,7}; Int add=ch[0]+ch[1]+ch[2]+ch[3]+ch[4]; System.out.print(add); . . You got the ans . . In python a=[5,2,3,9,7] Temp=0 For i in range(len(a)): Temp+=a[i] Print(temp) . . . Use this program u got the ans. Happy coding 😊
7th May 2021, 5:25 AM
santhosh Kumar
santhosh Kumar - avatar
- 2
Here n is the number for which you want to find ans
6th May 2021, 2:27 PM
YUGRAJ
- 5
There is simple thing to extract each digit from number int sum=0; while(n>0) { int x=n%10; n=n/10; sum+=x; }
6th May 2021, 2:27 PM
YUGRAJ