Skip to content

Ladydiana/JavaPracticeExercises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Practice Exercises

Set 1

  1. Find the area of a circle of radius r.
  2. Find the area of a parallelogram of base B and height H.
  3. Find the area of a rectangle of length L and width W.
  4. Find the area of a square of length L.
  5. Find the area of a triangle of lengths a, b, c.
  6. Find the area of a triangle of base B and height H.
  7. Find the perimeter of a circle of radius r.
  8. Find the perimeter of a rectangle of length L and width W.
  9. Find the perimeter of a right triangle of lengths of the 2 legs a and b.
  10. Find the perimeter of a square of length L.
  11. Find the perimeter of a triangle of lengths a, b, c.
  12. Find the volume of a cube of length L.
  13. Find the volume of a pyramid with base area A and height H.
  14. Find the volume of a prism of length L, height H and width W.
  15. Find the volume of a sphere of radius r.

Set 2

  1. Write a program to compute the arithmetic mean of 2 numbers a and b.
  2. Find the sum of an arithmetic series, where the first element is a1, …
  3. You read a number of 3 digits. Eliminate 1 digit so that you obtain t…
  4. Write a program which reads a number n and outputs its control digit.
  5. Write a program to convert decimal number to binary format.
  6. We consider coordinate points A(x1,y1) and B(x2,y2) in space. Find th…
  7. We consider coordinate points A(x1,y1) and B(x2,y2) in space.
  8. Write a program which reads a number n formed of 4 digits.
  9. Write a program which reads a number n formed of 4 digits. Write an a…
  10. Elimitate de middle digit from a 5 digit number n.
  11. Print the number of digits forming number n.
  12. Compute the sum of the digits forming number n.
  13. You read numbers until meeting 0. Find the first even and last odd nu…
  14. Print the first n numbers different from 0.
  15. Find the intersection point in the graphs of 2 given functions.
  16. Write a program to compute the arithmetic mean of 2 numbers a and b.
  17. Find the medium weight and height for the n students from a classroom…
  18. You read numbers until meeting 0. Find the minimum and maximum in the…
  19. Print all natural divisors of number n.
  20. You read a natural number n and a digit k. Decide if the digit k appe…
  21. Print the reverse of natural number n.
  22. Write a program to interchange the values of 2 variables a and b
  23. Write a program to find out if a number is a palindrome or not.
  24. Write a program to find if a number n is a perfect number or not.
  25. Print all the perfect squares smaller or equal to n.
  26. Find the sum of all the prefixes of natural number n.
  27. Print the count of the prime numbers found in positive interval [a, b].
  28. Print all the prime numbers found in positive interval [a, b].
  29. Write a program to check the given number is a prime number.
  30. Write a program to print of the first n prime numbers.
  31. Print the product of the first n numbers.
  32. Find out if all the numbers read until meeting 0 have the same sign o…
  33. Solve the second degree equation: ax^2+bx+c.
  34. Simplify a fraction a/b, where a and b are different from 0.
  35. Find the sum of all the suffixes of natural number n.
  36. Find the sum of the second powers of the first n digits.
  37. Find the sum of the third powers of the first n digits.
  38. Print the sum of the first n numbers.

tier 1

  1. Write a program to find the maximum number in a given array.
  2. Write a program to convert binary format to decimal number.
  3. Write a program to sort an array using Bubble Sort.
  4. Write a program to identify common elements or numbers between two given arrays.
  5. Find out duplicate number between 1 to N numbers.
  6. Write a program to find out duplicate or repeated characters in a string.
  7. Write a program for Insertion Sort.
  8. Write a program to check if a given number is binary or not.
  9. Write a program to reverse a number.
  10. Write a sample code to reverse Singly Linked List by iterating through it only once.
  11. Write a program to find sum of each digit in the given number.

tier 2

  1. Write a program to find if a given number is an Armstrong number.
  2. Write a program to implement your own ArrayList class.
  3. Write a program to print fibonacci series.
  4. Given a string, find the longest substrings without repeating characters.
  5. You are given an array of numbers. Find out the array index or position where sum of numbers preceeding the index is equals to sum of numbers succeeding the index.
  6. Implement a Set using only primitives.
  7. Write a singleton class.
  8. Write a program to print all permutations of a given string.
  9. Write a program to reverse a string using recursive methods.
  10. Write a program to find the sum of the first x prime numbers.