import java.util.*;
public class Number_Questions {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter the Number : ");
int num = sc.nextInt();
System.out.println("Sum of Digits of " + num + " = " + SumOfDigits(num));
sc.close();
}
public static boolean PalindromeCheck(int x) {
int orig = x;
int neww = 0;
while (x > 0) {
neww = (10 * neww) + (x % 10);
x /= 10;
}
if (orig == neww)
return true;
else
return false;
}
public static boolean PrimeCheck(int x) {
for (int i = 2; i <= Math.sqrt(x); i++) {
if (x % i == 0) {
return false;
}
}
return true;
}
public static int CalculateFactorial(int x) {
if (x == 0)
return 1;
int product = x * CalculateFactorial(x - 1);
return product;
}
public static int SumOfDigits(int x) {
int sum = 0;
while (x > 0) {
sum += (x % 10);
x /= 10;
}
return sum;
}
}
Editor is loading...