## Sum of Digits of a Number using Recursion – Java Code

Write a java program to find sum of digits of a number using recursion. Given a number, Write a java code to calculate sum of digits of a number using recursion.

For example –

Input number : 123
Output : 6 (1 + 2 + 3)

In my previous tutorial, I have explained how to find sum of digit of a number using iterative approach. In this tutorial, we are  going to learn how we can do it using recursion.

## Find Largest of Three Numbers using Ternary Operator in Java

Write a java program to find largest of three numbers using ternary operator in java. Given a three input numbers, we have to write a java code to print largest of three numbers using ternary operator.

Subscribe Our Tutorials

Suppose, if we have three numbers a, b and c. If a is greater than b and c then a is the largest of three numbers. Similarly, if b is greater than a and c then b is the largest of three numbers else c is largest.

## Sorting Algorithms and their Time Complexities

In this tutorial, We are going to learn various sorting algorithms and their time complexities. Before comparing the time complexity of various sorting algorithms, let’s first understand what’s the time complexity of an algorithm and why it is important.

## Binary Search using Recursion in Java

Write a program to implement a Binary search using recursion in java. In this tutorial, I am going to discuss binary search algorithm and it’s implementation using recursion in Java.

In my previous tutorial, i have explained how to implement binary search in java using iterative approach.

## Java Program to Count Number of Words in a String

In this tutorial, I have explained a java program to count number of words in a string. Given an input string, write a code to count number of words in a string. The words in a string are separated by space(‘ ‘).

## Java Program to Reverse Each Words of a String

Write a java program to reverse each words of a string.  Suppose, If an input string is Java Programming then the output string should be avaJ gnimmargorP.

## Find Sum of Array Elements using Recursion – Java Code

Write a java program to find sum of array elements using recursion. Given an array of integers, we have to write a java code to calculate sum of array elements using recursion.

For example :

Input: arr[] = {2, 5, 6, 8, 9, 12}

Output : 42 (2+5+6+8+9+12)

## PHP Program to Print Prime Numbers between 1 to N using Sieve Algorithm

Write a php program to print prime numbers between 1 to N. In this tutorial, we are going to use Sieve of Eratosthenes algorithm to print prime numbers between 1 to N.

## Binary Search in PHP : Explain with Code Examples

Write a program to implement binary search in PHP. Given a sorted array, we have to write a PHP code to search an element using binary search algorithm.

## Java Program to Check Armstrong Number

Write a java program to check Armstrong number. In this program, we are going to write a java code which checks whether a number is Armstrong or not.

Let’s first understand what is Armstrong number?