+ 1

Can u give the program for this in java..

S=a/2+ a/5+ a/8+ a/11+ ........a/20

4th Mar 2017, 10:38 AM
0000
6 Réponses
+ 11
great answer sir...thank you
4th Mar 2017, 11:03 AM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 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. :)
4th Mar 2017, 10:58 AM
Giriraj Bhagat
Giriraj Bhagat - avatar
+ 1
no problem :) always ready to share my experience and knowledge
4th Mar 2017, 11:05 AM
Giriraj Bhagat
Giriraj Bhagat - avatar
+ 1
Sure I will just check it out :)
4th Mar 2017, 2:27 PM
Giriraj Bhagat
Giriraj Bhagat - avatar
0
I have posted 1 more question can u give the program for that @Giriraj Bhagat
4th Mar 2017, 2:26 PM
0000
0
I have posted the answers for both of your questions. If you have any querries do let me know
4th Mar 2017, 2:56 PM
Giriraj Bhagat
Giriraj Bhagat - avatar