0% found this document useful (0 votes)
16 views13 pages

Java Series Programs and Solutions

The document contains a collection of Java programming exercises focused on iterative constructs, nested loops, and user-defined methods. Each exercise includes specific series calculations or displays, with varying levels of complexity and user interaction. The exercises are designed to enhance understanding of Java programming concepts and series manipulation.

Uploaded by

deepak0478
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views13 pages

Java Series Programs and Solutions

The document contains a collection of Java programming exercises focused on iterative constructs, nested loops, and user-defined methods. Each exercise includes specific series calculations or displays, with varying levels of complexity and user interaction. The exercises are designed to enhance understanding of Java programming concepts and series manipulation.

Uploaded by

deepak0478
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Java Series Programs

[Link]

 Iterative Constructs in Java

Write a program in Java to display the first 10 terms of the following series:

10, 20, 30, 40, ……..

306 Likes

 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:

1, 4, 9, 16,

356 Likes

 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:

S = a2 + a2 / 2 + a2 / 3 + …… + a2 / 10

227 Likes

 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:

S = a + a2 / 2 + a3 / 3 + …… + a10 / 10

102 Likes

 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:

x - x2/3 + x3/5 - x4/7 + …. to n terms

119 Likes

 Iterative Constructs in Java

Using switch statement, write a menu driven program for the following:

(a) To find and display the sum of the series given below:

S = x1 - x2 + x3 - x4 + x5 - ………… - x20; where x = 2


(b) To display the series:

1, 11, 111, 1111, 11111

For an incorrect option, an appropriate error message should be displayed.

287 Likes

 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:

1, 2, 4, 7, 11,

289 Likes

 Java Nested for Loops

Write a program to compute and display the sum of the following series:

S = (1 + 2) / (1 * 2) + (1 + 2 + 3) / (1 * 2 * 3) + -------- + (1 + 2 + 3 + ----- + n ) / (1 * 2 * 3 * ----- * n)

163 Likes

 Java Nested for Loops

Write a program in Java to find the sum of the given series:

S = 1! + 2! + 3! + …. + n!

65 Likes

 Java Nested for Loops

Write a program in Java to input the values of x and n and print the sum of the following series:

S = 1 + (x+2)/2! + (2x+3)/3! + (3x+4)/4! + ……… to n terms

57 Likes

Showing 1 - 10 of 63 Questions
 Iterative Constructs in Java

Write a program in Java to print the following series:

3, 6, 12, 24, 48, ….. to n

53 Likes

 Java User Defined Methods

Design a class to overload a function series( ) as follows:

(a) void series (int x, int n) – To display the sum of the series given below:

x1 + x2 + x3 + ………. xn terms

(b) void series (int p) – To display the following series:

0, 7, 26, 63 ………. p terms

(c) void series () – To display the sum of the series given below:

1/2 + 1/3 + 1/4 + ………. 1/10

171 Likes

 Java User Defined Methods

Design a class to overload a method series( ) as follows:

1. double series(double n) with one double argument and returns the sum of the
series.
sum = (1/1) + (1/2) + (1/3) + ………. + (1/n)

2. double series(double a, double n) with two double arguments and returns the sum
of the series.
sum = (1/a2) + (4/a5) + (7/a8) + (10/a11) + ………. to n terms

237 Likes

 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:

3, 6, 9, 12,

83 Likes

 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:
4, 8, 16, 32,

92 Likes

 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:

1.5, 3.0, 4.5, 6.0,

80 Likes

 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:

0, 7, 26,

119 Likes

 Java Nested for Loops

Write a program in Java to print the series:

8, 88, 888, 8888, 88888, 888888

34 Likes

 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:

1, 9, 25, 49,

81 Likes

 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:

4, 16, 36, 64,

70 Likes

Showing 11 - 20 of 63 Questions
 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:

0, 3, 8, 15,

66 Likes

 Java User Defined Methods

Design a class to overload a function sumSeries() as follows:

(i) void sumSeries(int n, double x): with one integer argument and one double argument to find
and display the sum of the series given below:

x x x x x
s= − + − + ... ... ... ¿ n terms
1 2 3 4 5
(ii) void sumSeries(): to find and display the sum of the following series:

s=1+(1 ×2)+(1 ×2 ×3)+... ... ... +(1× 2× 3 × 4 … ... ... × 20)


122 Likes

 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:

24, 99, 224, 399,

60 Likes

 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:

2, 5, 10, 17,

93 Likes

 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:

1 + 4 + 9 + …… + 400

108 Likes

 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:


1 + (1/2) + (1/3) + …… + (1/20)

52 Likes

 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:

1 + (1/3) + (1/5) + …… + (1/19)

41 Likes

 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:

(1/2) + (2/3) + (3/4) + …… + (19/20)

87 Likes

 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:

2 - 4 + 6 - 8 + …… - 20

58 Likes

 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:

(1*2) + (2*3) + …… + (19*20)

54 Likes

Showing 21 - 30 of 63 Questions
 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:

S = (a*2) + (a*3) + …… + (a*20)

20 Likes

 Iterative Constructs in Java

Write the program to find the sum of the following series:

S = a + a2 + a3 + ……. + an

54 Likes

 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:

S = 1 + 22 / a + 33 / a2 + …… to n terms

38 Likes

 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:

S = 12/a + 32 / a2 + 52 / a3 + …… to n terms

29 Likes

 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:

S = 1/a + 1/a2 + 1/a3 + …… + 1/an

24 Likes

 Iterative Constructs in Java

Write a program in Java to find the sum of the given series:

S = x/2 + x/5 + x/8 + x/11 + …… + x/20

61 Likes

 Iterative Constructs in Java


Write a menu driven program to perform the following tasks by using Switch case statement:

(a) To print the series:

0, 3, 8, 15, 24, ………… to n terms. (value of 'n' is to be an input by the user)

(b) To find the sum of the series:

S = (1/2) + (3/4) + (5/6) + (7/8) + ……….. + (19/20)

203 Likes

 Iterative Constructs in Java

Using a switch statement, write a menu driven program to:

(a) Generate and display the first 10 terms of the Fibonacci series

0, 1, 1, 2, 3, 5

The first two Fibonacci numbers are 0 and 1, and each subsequent number is the sum of the
previous two.

(b) Find the sum of the digits of an integer that is input.

Sample Input: 15390


Sample Output: Sum of the digits = 18

For an incorrect choice, an appropriate error message should be displayed.

51 Likes

 Java Nested for Loops

Write Java program to find the sum of the given series:

1 + (1/2!) + (1/3!) + (1/4!) + ………. + (1/n!)

72 Likes

 Java Nested for Loops

Write Java program to find the sum of the given series:

1 + (1+2) + (1+2+3) + ………. + (1+2+3+ …… + n)

22 Likes

Showing 31 - 40 of 63 Questions
 Java Nested for Loops

Write Java program to find the sum of the given series:

1 + (1*2) + (1*2*3) + ………. + (1*2*3* …… * n)

47 Likes

 Java Nested for Loops

Write Java program to find the sum of the given series:

1 + 1 / (1+2) + 1 / (1+2+3) + ………. + 1 / (1+2+3+…..+n)

19 Likes

 Java Nested for Loops

Write Java program to find the sum of the given series:

(1/2) + (1/3) + (1/5) + (1/7) + (1/11) + ………. + (1/29)

35 Likes

 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:

0, 1, 2, 3, 6,

124 Likes

 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:

1, -3, 5, -7, 9,

65 Likes

 Iterative Constructs in Java

Write the program in Java to display the first ten terms of the following series:

1, 12, 123, 1234,

62 Likes

 Iterative Constructs in Java


Write the program in Java to find the sum of the following series:

S = 1 + 1 + 2 + 3 + 5 + ……. to n terms

97 Likes

 Iterative Constructs in Java

Write the program in Java to find the sum of the following series:

S = 2 - 4 + 6 - 8 + ……. to n

54 Likes

 Iterative Constructs in Java

Write the program in Java to find the sum of the following series:

S = 1 + (1+2) + (1+2+3) + ……. + (1+2+3+ ……. + n)

40 Likes

 Iterative Constructs in Java

Write the program in Java to find the sum of the following series:

S = 1 + (1*2) + (1*2*3) + ……. + (1*2*3* ……. * n)

29 Likes

Showing 41 - 50 of 63 Questions
 Iterative Constructs in Java

Write the program to find the sum of the following series:

S = a + a2 + a3 + ……. + an

54 Likes

 Iterative Constructs in Java

Write the program to find the sum of the following series:

S = (a+1) + (a+2) + (a+3) + ……. + (a+n)

19 Likes

 Iterative Constructs in Java

Write the program to find the sum of the following series:

S = (a/2) + (a/5) + (a/8) + (a/11) + ……. + (a/20)

43 Likes

 Iterative Constructs in Java

Write the program to find the sum of the following series:

S = (1/a) + (2/a2) + (3/a3) + ……. to n

23 Likes

 Iterative Constructs in Java

Write the program to find the sum of the following series:

S = a - a3 + a5 - a7 + ……. to n

27 Likes

 Java Nested for Loops

Write a program in Java to find the sum of the following series:

S = 1 + (3/2!) + (5/3!) + (7/4!) + ……. to n

97 Likes

 Java Nested for Loops


Write a program in Java to find the sum of the following series:

S = a + (a/2!) + (a/3!) + (a/4!) + ……. + (a/n!)

67 Likes

 Java Nested for Loops

Write a program in Java to find the sum of the following series:

S = a - (a/2!) + (a/3!) - (a/4!) + ……. to n

28 Likes

 Java Nested for Loops

Write a program in Java to find the sum of the following series:

S = (a/2!) - (a/3!) + (a/4!) - (a/5!) + ……. + (a/10!)

44 Likes

 Java Nested for Loops

Write a program in Java to input the values of x and n and print the sum of the following series:

S = 1 - x2/2! + x4/4! - x6/6! + ……. xn/n!

11 Likes

Showing 51 - 60 of 63 Questions
 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

27 Likes

 Java 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.

62 Likes

 Java 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 terms

22 Likes

Showing 61 - 63 of 63 Questions

You might also like