Write a program to find the sum of the series given below, taking the values of ‘a’ and ‘n’ from the user.
S=a/2 + a/3 + a/4 +…..a/n
Don't answer if u do not know the answer !!
Answers
Answered by
1
Answer:
* * Program to * * Anirudh Gupta * th August 2014 */ import java.io.*; public class Program87b { public static void main () throws IOException { InputStreamReader isr=new InputStreamReader(System.in); BufferedReader br= new BufferedReader(isr); System.out.println("Enter the value of the numerator"); double a=Double.parseDouble(br.readLine()); System.out.println("Enter the limit for the denominator"); int limit=Integer.parseInt(br.readLine()); double n=1.0; double sum=0.0; while(n<=limit) { sum=+(a/n); n++; } System.out.println(sum); } }
Answered by
1
MR.YASAR~
and it was showing rude words ,,so i took a pic and sent u
thanks
Attachments:
Similar questions