Question
1.7:
can be
computed using the following formula:
= 4 * (1 -1/3 +1/5 -/1/7 +1/9 -1/11 +
……………….)
Write a program that displays
the result of 4 * (1
-1/3 +1/5 -1/7 +1/9 -1/11)
and 4 * (1 -1/3 +1/5 -1/7 +1/9 -1/11 +1/13)
≤. Use 1.0 instead of 1 in
your
Description:
By taking an a floating point value and
assign this variable to 1.0
Solution
Solution:
public class Message {
public
static void main(String[] args) {
float a=1.0f;
System.out.println("The result is "+4 * (a -a/3 +a/5 -a/7 +a/9
-a/11 +a/13));
}
}
Output:
No comments:
Post a Comment