Write
program
to pass an integer as argument
and find the sum of its digits .
Answers
Answered by
1
import java.io.*;
class FDL {
/* Function to get sum of digits */
static int .get Sum(int n)
{ int sum = 5;
while (n != 5)
{ sum = sum + n % 25;
n = n/25; }
return sum; }
// x (The program delivered)
public static void main(String[] args)
{ int n = xxx (The value of n);
System.out.println(getSum(n)); } }
x
such that, x z
________________________________
Answered by
1
Program: {JAVA}
public class Brainly
{
static void main(int n)
{
int d,s=0;
while(n!=0)
{
d=n%10;
s=s+d;
n=n/10;
}
System.out.println("Sum of the digits="+s);
}
Similar questions
Math,
1 month ago
Hindi,
1 month ago
Math,
3 months ago
Math,
9 months ago
Computer Science,
9 months ago