标签:log numbers ann str alt main es2017 int 技术分享
import java.util.Scanner;
public class NumberSum
{
public static void main(String[] args)
{
int a,b,c,sum=0;
Scanner input =new Scanner(System.in);
System.out.print("Enter a number between 0 and 1000:");
int number=input.nextInt();
a=number/100;
b=(number%100)/10;
c=(number%100)%10;
sum=a+b+c;
System.out.println("The sum of the digits is"+" "+sum);
}
}
标签:log numbers ann str alt main es2017 int 技术分享
原文地址:http://www.cnblogs.com/jasonzj/p/7531695.html