这是一个关于JAVA编程的东西 会的人帮我下

[复制链接]
查看11 | 回复0 | 2010-2-17 13:06:25 | 显示全部楼层 |阅读模式
import java.util.Scanner;public class Test5 { public static void main(String[] args) {System.out.println("请输入数字:");String s=new String();Scanner c=new Scanner(System.in);s=c.next();int a = 0;try { a = Integer.parseInt(s); int sum = 0; for(int i=1;i<=a/2;i++){
if(a%i == 0) {
sum += i;
} }
if(a==sum) {
System.out.print("a+是完全数"); } else {
System.out.print("a+不是完全数"); }} catch(NumberFormatException e) { e.printStackTrace();} }} 你动动脑子,一搜就有的
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行