Sum = 1 + 12 + 123 + 1234 + 12345 + … + 1234567891011…n how to sum%10007 mod answer | Sololearn: Learn to code for FREE!

-3

# Sum = 1 + 12 + 123 + 1234 + 12345 + … + 1234567891011…n how to sum%10007 mod answer

test input 2 output 13

7/19/2017 12:12:45 PM

Ilyos Yuldoshev

+4

thanks

+4

You are welcome!

+3

no input 3 output sum = 1+12+123=136%10007

+1

import java.util.Scanner; public class Series  {  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 s = 0, c;                       // s for terms of series, c for counter to generate n terms   for (c = 1; c <= n; c++) {    s = s * 10 + c;    System.out.print(s + " ");   }  } } Output: Enter the number of terms: 6 1,  12,  123,  1234,  12345,  123456....... You just need to add up!😸

+1

Here you go. Sorry for the functions https://code.sololearn.com/cK6EYzD4k9ub/?ref=app

+1

+1

Here is JavaScript: https://code.sololearn.com/Ws9P3r5Q2MvK/?ref=app

+1

Just add %10007 Easy! I'll update my code right away.

+1

public class series { public static void main(String args[]) { int i,s=0; for(i=1;i<=9;i++) { s+=(s*10+1); } System.out.println("The sum of the series:"+s); } }

0

Can you say it in java that works on blue j