15,669,603 members
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.
Posted
Updated 30-Dec-22 5:20am

## Solution 1

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[^]

## Solution 2

Well, once you have the expression of the kth term of the series, say Sk, a simple loop is just enough.
Sk = n+10*n + .. + 10k * n
being a rather complex expression, possibly deserves a dedicated function.

## Solution 3

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.