Click here to Skip to main content
15,669,603 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
8. Write a program to calculate the sum of series up to n term. For example, if n=5 the series will become 5+55+555+5555+55555-61725

What I have tried:

I'm clueless plus im new to this so i clear got no plans how to sort it out.
Updated 30-Dec-22 5:20am

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
Share this answer
Well, once you have the expression of the kth term of the series, say Sk, a simple loop is just enough.
In your case
Sk = n+10*n + .. + 10k * n
being a rather complex expression, possibly deserves a dedicated function.
Share this answer
Do it on paper first. How would you generate the series of numbers.

Start by writing a 5 on the paper. On the next line, what would you have to do to make that 5 become 55? Can you do it again and get 555?

Until you have that procedure worked out, you don't need to start thinking about code at all.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900