Java Program to Find Length of a String

  • Java program to find length of a sting using length method.

In this java program, to find the length of a string we will use length() method. This method returns the length of this string which is equal to the number of characters in the string.

Java Program to Multiply Two Matrices

  • Java program to multiply two matrices using for loops.
  • Algorithm for matrix multiplication.

Java Program to Find Sum of Digits of a Number

  • Java Program to find the sum of digits of a number using while loop and using a function.

Given a number N, we have to add all digits of a N and print the sum on screen.
For Example,
Sum of digits of 2534 = 2 + 5 + 3 + 4 = 14

Java Program to Check Armstrong Number or Not

  • Write a java program to check whether a number is armstrong number or not.

In this java program, we have to check whether a given number is an armstrong number or not and print the result on screen.
Armstrong number is a number that is equal to the sum of cubes of its digits.
Examples of Armstrong Numbers : 0, 1, 2, 3, 153, 370, 407 etc.

Java Program to Find All Factors of a Number

  • Java program to print all factors of a number using loop and using a function.

Given a number N, we have ti print all factors of N using a java program. Before jumping into java program, here is the brief overview of factors of a number. A number F is a factor of number N, if and only if F divides N completely without leaving any remainder(N % F = 0). For example, 3 is a factor of 24 because 3 divides 24 without leaving any remainder.

Java Program to Print Armstrong Numbers Between 1 to N

  • Java program to print all armstrong numbers between 0 to N.

In this Java program, given a number N we have to print all armstrong numbers between 0 and N. Here is a brief introduction of armstrong number. Here is the list of first few armstrong numbers 0, 1, 2, 3, 153, 370, 407 ...

Java Program to Convert Celsius to Fahrenheit

  • Java program to convert temperature from Celsius to Fahrenheit.
  • Write a java program to convert temperature from Celsius to Fahrenheit.

In this java program, we have to convert celsius temperature to fahrenheit temperature scale. We will first take a celsius temperature as input from user and then convert it to fahrenheit temperature and print it on screen.

Java Program to Convert Fahrenheit to Celsius

  • Java program to convert temperature from Fahrenheit to Celsius.
  • Write a program in java to convert temperature from Fahrenheit to Celsius.

In this java program, we have to convert fahrenheit temperature to celsius temperature scale. We will first take a fahrenheit temperature as input from user and then convert it to celsius temperature and print it on screen.

Java Program to Find LCM and GCD of Two Numbers

  • Write a program in java to find gcd and lcm of two given numbers using loop and recursion.

Given two integers, we have to find the lcm and gcd of two numbers. Before jumping into java program, here is the brief introduction of lcm and gcd od two numbers.

Java Program to Print Prime Numbers between 1 to 100

  • Java program to print all prime numbers between 1 to 100 using for loop.

In this java program, we have to print all prime numbers between 1 to 100. There are various methods of primality testing but here we will use a basic method of repetitive division.