Answer to Question #265936 in Computer Networks for H A

Question #265936

Write a fruitful function sum_to(n) that returns the sum of all integer numbers up to and

including n. So sum_to(10) would be 1+2+3. . . +10 which would return the value 55.


1
Expert's answer
2021-11-14T10:43:15-0500
into sum=0;
int sum_to(n){
for(int i=1;i=<n;i++){
sum=sum+i;
}
return sum;
} 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS