Computer Science, asked by idkkk70lolllll, 16 days ago

write a Java program to demonstrate this :​

Attachments:

Answers

Answered by samarthkrv
1

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

 double sum = 0 , n = 19;

 Scanner sc = new Scanner(System.in);

 System.out.print("Enter the value for x:");

 double x = sc.nextDouble();

     for(int i = 0; i <= n; i++){

         if(i%2 == 1){

             sum = sum + (x/(float)i);

         }

     }

    System.out.println(sum);

}

}

Explanation:

Similar questions