please help
write a program in java to find the sum of the given series: S=x/2+x/5+x/8+x/11+.................+x/20
Answers
Answered by
17
Explanation:
//to find the sum of the given series
import java.util.*;
class Series
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int x,a,i,s=0;
System.out.println("Enter x");
x=sc.nextInt;
a=2;
for(i=1;i<=20;i++)
{
s=s+(x/a);
a=a+3;
}
System.out.println("Sum="+s);
}
}
Hope it helps.....
Answered by
1
Explanation:
see the above program to get the answers
Attachments:
Similar questions