0% found this document useful (0 votes)
12 views4 pages

Computer Project 1

The document outlines a computer project that includes acknowledgments, a conclusion on learning programming concepts in Java, and several Java programs demonstrating various algorithms. Key programs include calculating the sum of the first 10 numbers in the Lucas series, identifying perfect, abundant, or deficient numbers, printing a specific pattern, summing a series, and a menu-driven program for checking BUZZ numbers and finding GCD. Overall, the project emphasizes the importance of algorithm design and enhances problem-solving skills.

Uploaded by

Poonam Shaw
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)
12 views4 pages

Computer Project 1

The document outlines a computer project that includes acknowledgments, a conclusion on learning programming concepts in Java, and several Java programs demonstrating various algorithms. Key programs include calculating the sum of the first 10 numbers in the Lucas series, identifying perfect, abundant, or deficient numbers, printing a specific pattern, summing a series, and a menu-driven program for checking BUZZ numbers and finding GCD. Overall, the project emphasizes the importance of algorithm design and enhances problem-solving skills.

Uploaded by

Poonam Shaw
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
You are on page 1/ 4

Computer Project

Acknowledgement
I would like to express my sincere gratitude to my Computer Science teacher, [Teacher's
Name], for guiding me throughout this project. Their valuable suggestions and
encouragement helped me complete this project successfully. I would also like to thank my
parents and friends for their support and motivation during this work.

Conclusion
This project helped me understand important programming concepts in Java, such as loops,
conditional statements, recursion, and object-oriented programming. It enhanced my
problem-solving skills and taught me the importance of designing algorithms before coding.
I am confident that this experience will benefit me in my future endeavors.

Programs

1. Sum of First 10 Numbers of Lucas Series


class LucasSeries {
public static void main(String[] args) {
int a = 2, b = 1, sum = 0;
for (int i = 0; i < 10; i++) {
sum += a;
int temp = a + b;
a = b;
b = temp;
}
System.out.println("Sum of first 10 numbers in Lucas series: " + sum);
}
}

2. Perfect, Abundant, or Deficient Number


import java.util.Scanner;

class NumberType {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter an integer: ");
int num = sc.nextInt();
int sum = 0;

for (int i = 1; i < num; i++) {


if (num % i == 0) {
sum += i;
}
}

if (sum == num) {
System.out.println(num + " is a Perfect Number.");
} else if (sum > num) {
System.out.println(num + " is an Abundant Number.");
} else {
System.out.println(num + " is a Deficient Number.");
}
}
}

3. Print Pattern
class Pattern {
public static void main(String[] args) {
int n = 4;

for (int i = 1; i <= n; i++) {


for (int j = 1; j <= i; j++) {
System.out.print(j + " ");
}
for (int j = i - 1; j >= 1; j--) {
System.out.print(j + " ");
}
System.out.println();
}

for (int i = n - 1; i >= 1; i--) {


for (int j = 1; j <= i; j++) {
System.out.print(j + " ");
}
for (int j = i - 1; j >= 1; j--) {
System.out.print(j + " ");
}
System.out.println();
}
}
}

4. Sum of Series
class SeriesSum {
public static void main(String[] args) {
int totalSum = 0;

for (int i = 1; i <= 10; i++) {


totalSum += i * (i + 1) / 2;
}

System.out.println("Sum of the series: " + totalSum);


}
}

5. Menu-Driven BUZZ Number and GCD


import java.util.Scanner;

class MenuDriven {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("1. Check BUZZ Number");
System.out.println("2. Find GCD");
System.out.print("Enter choice: ");
int choice = sc.nextInt();

if (choice == 1) {
System.out.print("Enter a number: ");
int num = sc.nextInt();
if (num % 10 == 7 || num % 7 == 0) {
System.out.println(num + " is a BUZZ Number.");
} else {
System.out.println(num + " is not a BUZZ Number.");
}
} else if (choice == 2) {
System.out.print("Enter two numbers: ");
int a = sc.nextInt();
int b = sc.nextInt();

while (b != 0) {
int temp = b;
b = a % b;
a = temp;
}

System.out.println("GCD is: " + a);


} else {
System.out.println("Invalid choice.");
}
}
}

You might also like