Free webinar! How to Make Generative AI Work for You
Get my free ticket+ 5
Try and try but don't fail to try. Here comes my approach.
https://code.sololearn.com/cgSMw331od3O/?ref=app
+ 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.
+ 1
where will the loop conditions are applying in the loop ??
0
YUGRAJ ✧ιη∂ιαη ησвιтα✧ where's the declaration of 'n' variable?
you obviously need to put it in the code.
edit: i got it
0
Coding kitty it's just the way to write or algorithm. -_-
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
- 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 😊
- 2
Here n is the number for which you want to find ans
- 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;
}