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

Get Latest Updates on Facebook

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.

Check whether Two Strings are Anagram of each other

Given two strings, we have to write a code to check whether two strings are anagram of each other or not. In this programming question, we are going to write a java code to check whether two strings are anagram of each other or not.

Let’s first understand what is an anagram? and how we are going to solve this problem.

What is an Anagram?

Two strings are said to be anagrams of each other if it contains the same characters, only the order of characters in both the strings is different. In other words, both strings must contain the same exact letters in the same exact frequency.