Answer:
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
int x;
Scanner s = new Scanner(System.in);
System.out.print("Enter the number >>>"); // taking input
from user
x = s.nextInt();
Main obj = new Main(); // creating an object
int result = obj.sumOfDigits(x); // calling method
System.out.println("Sum of the digits is >>>"+result); //
printing the result
}
int sumOfDigits(int x) // called methos
{
if(x == 0) // base case in recursion
{
return 0;
}
if(x<0) // condition for negative numbers
{
x=-x;
}
if(x<=9 && x>0) // condition for single digit
number
{
return x;
}
else // recursion to find sum of digits
{
return (x%10) + sumOfDigits(x / 10);
}
}
}
output:
w e it, it's safer to stay in Protected View Enable Editing MAC 286 Please submit...
iruses. Unless you need to edit, it's safer to stay in Protected View Enable Editing Question 1 Use the following table for this question. Number of Workers Marginal Product 12 2 16 14 Total Product Average Product 10 a. Fill out the columns of the Table b. With which worker do diminishing returns occur? c. Graph the marginal and average product curves. Product 0 1 2 3 4 5 6 L
s you need to edit. It's safer to stay in Protected View. Enable Editing During the last three months (April, May, and June) of the first fiscal year of operations of My Assistant, a few new types of transactions began to occur. These involve different ways the company is paying for some items, different ways the company is being paid, and the earning of interest. In all cases, keep in mind that economic events need to be reported when they...
you need to edit, it's safer to stay in Protected View Enable Editing Discussion 1. Imagine a bowling ballresting in a shallow depression on the side of a hill. Only a narrow rim of dirt below the ball prevents it from rolling down the hill. Now imagine a shovel digging away that rim of dirt. If you remove enough dirt from below the ball - it will start to roll... In terms of enzyme activity, correctly label each italicized term...explaining...
Mailings Review View Help ses. Unless you need to edit, it's safer to stay in Protected View Enable Editing LO 2-2,2-3, 2-4 Exercise 2-88 Elefaccrue the neces They los experienced the wing events in Your 1 in your operation 1. Recived $20,000 cash from the common stock 2. Performed services on sccount for $38.000 3. Puld the t ype of $2.500. 4. Collected $21.000 of the accounts receivable 5. Recorded $15.000 of crud salaries at the end of the year...
ses. Unless you need to edit, it's safer to stay in Protected View Enable Editing activate now. Reactivate 1. Given an angle of 18°15'02', convert the angle to degrees with decimal rounded to the nearest 0.001" (4 pts.) 2. Given an angle of 48.871", convert the angle to degrees, minutes, and seconds (DMS). Round to the nearest second. (4 pts.) 3. A downhill slope measures 402.22' from point to point D. Both points are on the ground. The elevation at...
Internet can contain viruses. Unless you need to edit, it's safer to stay in Protected View Enable Editing 2) Is this an n-tree? If so, for what integer n? IN Vg Figure HW 7
YOU REPELICU Enable Editing can contain viruses. Unless you need to edit it's safer to stay in Protected View 3. Indicate whether the amino acids in the table below are likely to have isoelectric points near pH 6, below pH 6 or above pH 6. 0 H3-C CH-C0° Structure of amino acid H3NCH-0-0 CH-CH3 CH ON CH3 0- Estimated isoelectric point (near pH 6, below pH 6 or above pH 6) SP3 wi
Protected View. viruses. Unless you need to edit, it's safer to stay in Enable Ed I 21. Lee had the following income and losses during the current year: $52,000 12,000 Wages Share of S Corporation income Unemployment compensation Group life insurance Prize won from a charity raffle 6,500 35,000 10,000 1,000 What is Lee's adjusted gross income? A) $64,000 B) $71,500 C) $100,000 D) $106,500
you need to edit, it's safer to stay in Protected View. Enable Editing Part 2- Time to Dig Deeper - Doin' Your Research 1. Remember critical thinking is about exposing yourself to OTHER thinking and evaluating it. Now you will RESEARCH the topic. For this you need to find 2 FACTS that support the ban and 2 FACTS that oppose the ban (you can have more but you must have a MINIMUM of two for each). You will not only...
Mailings Review View Help ses. Unless you need to edit, it's safer to stay in Protected View Enable Editing LO 2-2,2-3, 2-4 Exercise 2-88 Elefaccrue the neces They los experienced the wing events in Your 1 in your operation 1. Recived $20,000 cash from the common stock 2. Performed services on sccount for $38.000 3. Puld the t ype of $2.500. 4. Collected $21.000 of the accounts receivable 5. Recorded $15.000 of crud salaries at the end of the year...