program to print the series (1/2)+(5/6)+(7/8)+(19/20) in java language
Answers
Answered by
0
the answer is 3.158333
Answered by
0
Answer:
import java . util. * ;
class java
{
public void display ( ) // Display method
{
system . out . println ( (1 / 2) + (5 / 6) + (7 / 8) + ( 19 / 20) ) ;
}
// Main method
public static void main ( string args [] )
{
// creating object of java class
java obj = new java ( );
obj . display ( ) ; // here we are calling the display function
}
system. out. println is used to print a message.
public is a access specifier.
new keyword is used to create a object of a class.
Similar questions