write a Java program to demonstrate this :
Attachments:
Answers
Answered by
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
Math,
8 days ago
English,
16 days ago
Biology,
9 months ago
English,
9 months ago
Social Sciences,
9 months ago