Computer Science, asked by pintumondol711, 3 months ago

Write
program
to pass an integer as argument
and find the sum of its digits .

Answers

Answered by ғɪɴɴвαłσℜ
1

\sf{\huge{\underline{\green{Answer :-}}}}

\sf{\large{\underline{\pink{Programme\:= \:Java }}}}

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)); } }

\sf{\large{\underline{\orange{Result :- }}}}

x

such that, x \in z

________________________________

Answered by CopyThat
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