Java : Math - Exercises and Solution


1. Write a Java method to find the smallest number among three numbers

View Solution

2. Write a Java method to compute the average of three numbers

View Solution

3. Write a Java method to display the middle character of a string

View Solution

4. Write a Java method to count all vowels in a string

View Solution

5. Write a Java method to count all words in a string

View Solution

6. Write a Java method to compute the sum of the digits in an integer

View Solution

7. Write a Java method to display the first 50 pentagonal numbers

View Solution

8. Write a Java method to compute the future investment value at a given interest rate for a specified number of years

View Solution

9. Write a Java method to create the area of a pentagon

View Solution

10. Write a Java program to round a float number to specified decimals

View Solution

11. Write a Java program to count the absolute distinct value in an array

View Solution

12. Write a Java program to convert an integer value to absolute value

View Solution

13. Write a Java program to convert a float value to absolute value

View Solution

14. Write a Java program to accept a float value of number and return a rounded float value

View Solution

15. Write a Java program to accept two integers and return true if the either one is 15 or if their sum or difference is 15

View Solution

16. Write a Java program to count the number of prime numbers less than a given positive number

View Solution

17. Write a Java program to find the length of the longest sequence of zeros in binary representation of an integer

View Solution

18. Write a Java program to multiply two integers without using multiplication, division, bitwise operators, and loops

View Solution

19. Write a Java program to calculate power of a number without using multiplication(*) and division(/) operators

View Solution

20. Write a Java program to check if a given number is Fibonacci number or not

View Solution

21. Write a Java program to print all prime factors of a given number

View Solution

22. Write a Java program to convert Roman number to an integer number

View Solution

23. Write a Java program to Convert radian to a degree using library method

View Solution

24. Write a Java program to Demonstrate the Math.multiplyExact() method

View Solution

25. Write a Java program to Demonstrate the Math.subtractExact() method

View Solution

26. Write a Java program to Demonstrate the Math.floorDiv() method

View Solution

27. Write a Java program to Demonstrate the Math.copySign() method

View Solution

28. Write a Java program to Perform the ceiling operation on the decimal number using the library method

View Solution

29. Write a Java program to Round off the decimal number using the library method

View Solution

30. Write a Java program to Find the sign of given number using library method

View Solution

31. Write a Java program to Find the largest number between two numbers using the library method

View Solution

32. Write a Java program to Find the smallest number between two numbers using the library method

View Solution

33. Write a Java program to Find the absolute value of a number using library method

View Solution

34. Write a Java program to Find the cube root of a number using library method

View Solution

35. Write a Java program to Find the hyperbolic tangent of an angle

View Solution

36. Write a Java program to Find the hyperbolic cosine of an angle

View Solution

37. Write a Java program to Find the hyperbolic sine of an angle

View Solution

38. Write a Java program to Find the trigonometric arc tangent of an angle

View Solution

39. Write a Java program to Find the trigonometric arc cosine of an angle

View Solution

40. Write a Java program to Find the trigonometric arc sine of an angle

View Solution

41. Write a Java program to Find the trigonometric tangent of an angle

View Solution

42. Write a Java program to Find the trigonometric cosine of an angle

View Solution

43. Write a Java program to Find the trigonometric sine of an angle

View Solution

44. Write a Java program to Convert degree to radian using library method

View Solution

45. Write a Java program to Find the logarithmic value of a Number

View Solution

46. Write a Java program to Calculate area of Hexagon

View Solution



Basic Programs