Java Series Programs
Java Nested for Loops
Write a program in Java to find the sum of the following series:
S = (2/a) + (3/a2) + (5/a3) + (7/a4) + ……. to n
View Answer24 Likes
User Defined Methods
Design a class to overload a function series( ) as follows:
(a) void series(int a, int n) — To display the sum of the series given below:
a - (a/2!) + (a/3!) - (a/4!) + …… n terms
(b) void series(int n) — To display the sum of the series given below:
1/2 - 2/3 + 3/4 - 4/5 + …… n terms
Write a main method to create an object and invoke the above methods.
View Answer39 Likes
User Defined Methods
Using switch statement write a menu driven program to overload a function series as follows:
(a) void series() — To find and display the sum of the following series:
S = 2 - 4 + 6 - 8 + 10 ….. - 20(b) void series(int n, int x) — To find and display the sum of the following series:
S = (x2 / 1!) + (x4 / 3!) + (x6 / 5!) + ……. to n termsView Answer20 Likes
Showing 61 - 63 of 63 Questions