write a program accept a number and find the sum of digits of the number
yakumoreyucurry:
Is this program supposed to be written in Java or in QBASIC or in any other programming language?
Answers
Answered by
3
public class sum
{
public static void main(int n)
{
int r,sum=0;
while(n>0)
{
r=n℅10;
sum=sum+r;
n=n/10;
}
System.out.print(sum);
}
}
{
public static void main(int n)
{
int r,sum=0;
while(n>0)
{
r=n℅10;
sum=sum+r;
n=n/10;
}
System.out.print(sum);
}
}
Similar questions
Economy,
8 months ago
English,
8 months ago
English,
8 months ago
English,
1 year ago
Social Sciences,
1 year ago
Math,
1 year ago
Social Sciences,
1 year ago