Computer Science, asked by anjalijoshi8777, 4 months ago

Find the sum of the following series:

S = 5+ 55 +555+ 5555+........ upto n terms. ​

Answers

Answered by mathdude500
3

Answer:

\boxed{\sf \: 5 + 55 + 555 + 5555 + .. \: n \: terms  =  \: \dfrac{5}{9}\left[\dfrac{10( {10}^{n}  - 1)}{9}  - n \right] \: } \\  \\

Explanation:

Given series is

\sf \: 5 + 55 + 555 + 5555 + ... \: n \: terms \\  \\

\sf \:  =  \: 5(1 + 11 + 111 + 1111 + ... \: n \: terms) \\  \\

\sf \:  =  \: \dfrac{5}{9} (9 + 99 + 999 + 9999 + ... \: n \: terms) \\  \\

\sf \:  =  \: \dfrac{5}{9} [(10 - 1) + (100 - 1) + (1000 - 1)  + ... \: n \: terms]\\  \\

\sf \:  =  \: \dfrac{5}{9}[ 10 + 100 + 1000 + .. \: n \: terms) - (1 + 1 + 1 + .. \: n \: terms)] \\  \\

We know,

Sum of n terms of a GP series having first term a and common ratio r is given by

\begin{gathered}\begin{gathered}\bf\: S_n = \begin{cases} &\sf{\dfrac{a( {r}^{n} - 1) }{r - 1} }, \:  \: r \:  \ne \: 1 \\ \\  &\sf{\qquad \: na, \:   \:  \: \: r = 1} \end{cases}\end{gathered}\end{gathered} \\  \\

So, using these results, we get

\sf \:  =  \: \dfrac{5}{9}\left[\dfrac{10( {10}^{n}  - 1)}{10 - 1}  - n \times 1 \right] \\  \\

\sf \:  =  \: \dfrac{5}{9}\left[\dfrac{10( {10}^{n}  - 1)}{9}  - n \right] \\  \\

Hence,

\implies\sf \: 5 + 55 + 555 + 5555 + .. \: n \: terms  =  \: \dfrac{5}{9}\left[\dfrac{10( {10}^{n}  - 1)}{9}  - n \right] \\  \\

Answered by krishnajana295
3

\huge\pink{\mid{\underline{\overline {\tt Answer:-}} \mid}}

______________________________

c \: language

#include <stdio.h>

#include <math.h>

int main()

{

int n, i, sum = 0;

printf("Enter the number of terms: ");

scanf("%d", &n);

for (i = 1; i <= n; i++)

{

sum += (int)(pow(10, i) - 1) / 9 * 5;

}

printf("The sum of the series is: %d", sum);

return 0;

}

______________________________

java  -

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter the number of terms: ");

int n = sc.nextInt();

int sum = 0;

for (int i = 1; i <= n; i++) {

int num = Integer.parseInt("5" + String.format("%0" + (i - 1) + "d", 0));

sum += num;

}

System.out.println("Sum of the series: " + sum);

}

}

______________________________

python

def sum_series(n):

sum = 0

for i in range(1, n+1):

sum += int(str(5) * i)

return sum

n = int(input("Enter the number of terms: "))

print("The sum of the series upto", n, "terms is:", sum_series(n))

______________________________

\boxed{Thanks}

______________________________

  {\red {I  \: hope  \: this  \: may  \: help \:  you}}

Similar questions