Series part 1
Series part 1: solved Java program for ICSE Class 9 Computer Applications with complete BlueJ code, explanation and sample output.
// 1. Print the series 0.5, 5.5, 55.5, 555.5 ...
import java.io.*;
class series1
{
public static void main()
{
double num=0.5;
System.out.print(num);
for(int i=0;i<7;i++)
{
num+=5*Math.pow(10,i);
System.out.print(", "+num);
}
}
}<tbody>
o/p
0.5, 5.5, 55.5, 555.5, 5555.5, 55555.5, 555555.5, 5555555.5
</tbody>
// 2. Find the sum of the series 2 - 4 + 6 - 8 + ... up to n
import java.io.*;
class series2
{
public static void main()throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter a number of ur choice");
int n=Integer.parseInt(br.readLine());
int count=1;
int sum=0;
for(int i=2;i<=n;i+=2)
{
if(count%2!=0)
{
sum+=i;
}
else
{
sum-=i;
}
count++;
}
System.out.println("Sum of the series = "+sum);
}
}3. Find the sum of the series
1!+2!+3!+..........+n!
import java . io.*;
public class series3
{
public static void main() throws IOException
{
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter a Number");
int n = Integer.parseInt (br.readLine());
int sum=0;
for(int i=1;i<=n;i++)
{
int fact =1;
for(int j=1;j<=i;j++)
{
fact*=j;
}
sum+=fact;
}
System.out.println(sum);
}
}Related Posts
Continue learning with these related articles
Sum of First n Natural Numbers in Java (Loop and Formula)
Find the sum of the first n natural numbers in Java with a for loop, a while loop and the formula n(n + 1)/2, with a dry run and the sums of even numbers, odd numbers, squares and cubes.
Prime Number Program in Java: Check a Number and Print Primes in a Range
Check whether a number is prime in Java by counting its factors, a faster square-root method with isPrime(), and a program that prints all prime numbers in a range.

Encapsulation, Access Specifiers and Scope of Variables in Java for ICSE Class 10
ICSE Class 10 Computer Applications notes on encapsulation: private, default, protected and public access, data hiding with getter and setter methods, instance vs static (class) variables, local variables and scope, with a solved BankAccount program.