A simple Java console application containing 8 introductory programming tasks. Each task is implemented as a separate method and is tested through user input in the main() method.
Q1 β Prime Number Check
Checks whether an integer n > 1 is a prime number.
Q2 β Factorial
Computes the factorial of a number using an iterative loop.
Q3 β Combinations (n choose k)
Calculates the number of combinations using:
C(n, k) = n! / (k! * (n - k)!)
Q4 β Count Digits
Counts how many digits a positive integer contains.
Q5 β Quadratic Equation Solver
Solves axΒ² + bx + c = 0.
If the discriminant is negative, prints that no real solutions exist.
Q6 β Triangle Area (Heron's Formula)
Computes the area:
A = sqrt(s * (s - a) * (s - b) * (s - c))
Q7 β Reverse Digits
Reverses the digits of a positive integer.
Q8 β Minimum Digit
Finds the smallest digit inside a positive integer.
Compile:
javac Application1.java
Run:
java Application1
Application1.java β contains all 8 methods + main() for input/output.
Thomas Vasilas