General instruction:- Make a directory named esc101-lab03 before starting. You should put all the programs in this directory.
Write a Java class with a main method that declares an integer and initializes it to a positive number. The program prints the sum of the digits of the number.
Write a Java class with a main method that declares an integer and
initializes it to a four-digit number. The program checks if it is a
palindrome. A palindrome is a number which when read in the reverse direction
is the same as the original number. For example, 1771 is a palindrome.
Sample output in this case: The input is 1771. It is a palindrome.
However, 1234 is not a palindrome. Sample output in this case: The input is 1234. It is not a palindrome.
Can you extend this program to check if an integer with any number of digits is
a palindrome?
Write a Java class with a main method to print all primes within 10000. How many primes are there between 0 and 1000, and 1000 and 10000?
Write a Java class with a main method that declares an integer and initializes it to a positive number (> 1000). The program prints the reverse of the digits of the number.
Fibonacci series is a series of numbers starting from 0,1 such that each number is the sum of previous two numbers.eg
0 1 1 2 3 5 8 13
Write a Java class with a main method that declares an integer n(number of terms in fibonacci series) and prints
the first n terms of Fibonacci series.
Write a Java class with a main method to print the factorial of a number n.
Write a java program that declares and initializes an integer 'n'. The program should calculate and print the integer 2^n, using the for loop construct. Re-write the program using the while loop and the do-while loop.
Write a java program to calculate and print the sum of all prime numbers between 2 and 50.
Write a java program to find and print all 3 digit integers which are palindromes. (A 3-digit integer qualifies for a palindrome if its symmetric, ie, having the same first and last digit eg. 131, 595...).
Write a java program to print the first 20 terms and the sum of a arithmetic progression given its first term, increment and the number of terms.
Write a java program to print the prime factors of a given integer.
Write a java program to convert a number into it's binary equivalent and find its 2's complement without converting it back into decimal format. Do not use library function for conversion.
Write a program to find the hexadecimal representation of a non-negative integer. For ex., the output for 121 should be 79, and for 122 it should be 7A (make no assumption on the number of digits).
Write a program to find the binary representation of a positive decimal
fraction (in [0, 1), i.e. the integer part is 0). For ex., the output for
0.75 should be 0.11 (make no assumption on the number of places after the
point).
Multiply the number by 2. If the integer part becomes 1, it has a component of 1/2.
Ignore the integer part. Again multiply the new fraction by 2. If the integer part
becomes 1,
it has a component of 1/4, and so on. This is just the inverse process of
converting an integer to binary representation. The process terminates when
the fraction becomes exactly 0 (or 1.0, depending on how you interpret it).
Write a program to print out "victory!" (V sign) (with any
number of rows):
* *
* *
* *
* *
* *
*