Java Programs

TheFestFever.com

Our aim is to connect students from campuses all over Delhi by making them aware of all Technical, Cultural, Management fests, workshops, Seminars organized by every college in Delhi.

Join Us Now


Program 1: Write a Java program to calculate the area of the rectangle.


Program 2: Write a Java program to calculate the volume of the Sphere.


Program 3: Write a Java program to calculate CGPA and Percentage of the marks of four subjects entered by the user.


Program 4: Write a Java program to convert temperature in Celsius to Fahrenheit.


Program 5: Write a Java program to calculate the Surface Area of the Cuboid.


Program 6: Write a Java program to print all prime numbers between 1 to n (n is the number entered by the user).


Program 7: Write a Java program to calculate the average of the n numbers entered by the user.


Program 8: Write a Java program to calculate the factorial of a number.


Program 9: Write a Java program to calculate the permutation of a given number.


Program 10: Write a Java program to calculate the combination of a given number.


Program 11: Write a Java program to calculate the sum of the digits of a number.


Program 12: Write a Java program to swap two numbers.


Program 13: Write a Java program to duplicate an array entered by the user.



Program 14: Write a Java program to display the elements at even position of an array.


Program 15: Write a Java program to calculate the sum of the elements in an array.


Program 16: Write a Java program to rotate the elements in an array to the left.


Program 17: Write a Java program to rotate the elements in an array to right.


Program 18: Write a Java program to calculate the largest of the elements present in an array.


Program 19: Write a Java program to calculate the smallest of the elements present in an array.


Program 20: Write a Java program to determine the duplicate elements in an array.


Program 21: Write a Java program to calculate the frequency of the elements in an array.


Program 22: Write a Java program to search a number in an array and return its index number and if the element is not found in the array return (-1).


Program 23: Write a Java program to sort the array in increasing order.


Program 24: Write a Java program to sort the array in decreasing order.


Program 25: Write a Java program to calculate the addition of two matrices entered by the user.


Program 26: Write a Java program to calculate the subtraction of two matrices entered by the user.



Program 27: Write a Java program to determine if the entered matrix is an identity matrix.


Program 28: Write a Java program to determine if the entered matrix is a sparse matrix.


Program 29: Write a Java program to print the lower triangular matrix of the entered matrix.


Program 30: Write a Java program to print the upper triangular matrix of the entered matrix.


Program 31: Write a Java program to calculate the frequency of even and odd numbers in the matrix.


Program 32: Write a Java program to calculate the multiplication of two matrices.


Program 33: Write a Java program to perform transpose of a matrix.


Program 34: Write a Java program to perform binary search.


Program 35: Write a Java program to bubble sort.


Program 36: Write a Java program to perform selection sort.


Program 37: Write a Java program to perform insertion sort.


Program 38: Write a Java program to perform merge two arrays.


Program 39: Write a Java program to check if a string is a palindrome or not.



Program 40: Write a Java program to replace occurrence of every with the other character entered by the user in the given string.


Program 41: Write a Java program to count number of words in a string.


Program 42: Write a Java program to display all the substrings of a string.


Program 43: Write a Java program to reverse each word of a string.


Program 44: Write a Java program to remove consecutive duplicates in a string.


Program 45: Write a Java program to remove every occurrence of a character in a string.


Program 46: Write a Java program to do basic string compression. For a character which is consecutively repeated more than once, replace consecutive duplicate occurrences with the count of repetitions.


Program 47: Write a Java program to print the following star pattern.
    *
    * *
    * * *
    * * * *
    * * * * *


Program 48: Write a Java program to print the following star pattern.
    * * * * *
    * * * *
    * * *
    * *
    *


Program 49: Write a Java program to print the following number pattern.
    1
    1 2
    1 2 3
    1 2 3 4
    1 2 3 4 5


Program 50: Write a Java program to print the following number pattern.
    1 2 3 4 5
    1 2 3 4
    1 2 3
    1 2
    1