Write a Java program to input three digit numbers and print the addition of all the digits. Ex: Input : 367= 3+6+7= 16 = Output : 16
" It is a humble request that if you know the answer then only reply".
Answers
Answered by
5
Answer:
class addition
{
void main(int n)
{
int sum=0;
for( int k=0;k<3;k++)
{
int j=n%10;
n=n/10;
sum=sum+j;
}
System.out.println(sum);
}
}
Explanation:
Answered by
24
Answer:
See this.
Explanation:
Attachments:
Similar questions