Computer Science, asked by debarghyamullick, 2 months ago

Design a class to overload a function sum() as follows:
(a) void sum(int n) – with one int argument that finds the sum of the digits in n.
(b) void sum(Integer n) – with one Integer argument that finds the sum of the digits in n.
Also create the main() method to call the above methods.

Answers

Answered by drishti3275
1

Answer:

your question is somewhat wrong. I have written the program for the portion(of question) which is correct. Mark me brainliest. Thanks

Explanation:

class over

{

static void sum(int n)

{

int d,sum=0;

d=n%10;

sum=sum + d;

n=n/10;

System.out.println ("Sum=" +sum);

}

Similar questions