+ 1
Can u give the program for this in java..
S=a/2+ a/5+ a/8+ a/11+ ........a/20
6 odpowiedzi
+ 11
great answer sir...thank you
+ 3
import java.util.*;
public class Program
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the value for A ");
double input = sc.nextFloat();
double sum=0;
for(int i=2;i<=20;i+=3) // to divide by 2,5,8 so on that is why increase by 3 to i
{
sum+=input/i;
}
System.out.println(sum );
}
}
If you have any question feel free to ask me. :)
+ 1
no problem :) always ready to share my experience and knowledge
+ 1
Sure I will just check it out :)
0
I have posted 1 more question can u give the program for that @Giriraj Bhagat
0
I have posted the answers for both of your questions. If you have any querries do let me know