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;
}
[Link]("Sum of first 10 numbers in Lucas series: " + sum);
}
}
2. Perfect, Abundant, or Deficient Number
import [Link];
class NumberType {
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter an integer: ");
int num = [Link]();
int sum = 0;
for (int i = 1; i < num; i++) {
if (num % i == 0) {
sum += i;
}
}
if (sum == num) {
[Link](num + " is a Perfect Number.");
} else if (sum > num) {
[Link](num + " is an Abundant Number.");
} else {
[Link](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++) {
[Link](j + " ");
}
for (int j = i - 1; j >= 1; j--) {
[Link](j + " ");
}
[Link]();
}
for (int i = n - 1; i >= 1; i--) {
for (int j = 1; j <= i; j++) {
[Link](j + " ");
}
for (int j = i - 1; j >= 1; j--) {
[Link](j + " ");
}
[Link]();
}
}
}
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;
}
[Link]("Sum of the series: " + totalSum);
}
}
5. Menu-Driven BUZZ Number and GCD
import [Link];
class MenuDriven {
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("1. Check BUZZ Number");
[Link]("2. Find GCD");
[Link]("Enter choice: ");
int choice = [Link]();
if (choice == 1) {
[Link]("Enter a number: ");
int num = [Link]();
if (num % 10 == 7 || num % 7 == 0) {
[Link](num + " is a BUZZ Number.");
} else {
[Link](num + " is not a BUZZ Number.");
}
} else if (choice == 2) {
[Link]("Enter two numbers: ");
int a = [Link]();
int b = [Link]();
while (b != 0) {
int temp = b;
b = a % b;
a = temp;
}
[Link]("GCD is: " + a);
} else {
[Link]("Invalid choice.");
}
}
}