package com.iflytek.helloworld;
/**
* "Tools": "Created with IntelliJ IDEA",
* "Company": "Copyright © 1999 - 2023 iFLYTEK .CO.LTD.(HeFei) ALL Right Reserved.",
* "Author": "Coder.Mr.T",
* "Email": "xjd_aiit_1960_thj@163.com || 2908597938@qq.com",
* "GitHub": "<a href="https://github.com/Coder-Mr-T">...</a>",
* "Gitee": "<a href="https://gitee.com/AIITCherry">...</a>",
* "Date": "Do not edit", // 文件创建时间(不变)
* "LastEditors": "HashMap2020 && xjd_aiit_1960_thj@163.com", // 文件最后编辑者
* "LastEditTime": "Do not edit", // 文件最后编辑时间
* "FilePath": "Do not edit", // 文件在项目中的相对路径 自动更新
* "Description": "To Do..."
*/
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
int n = scanner.nextInt();
for (int i = 1; i <= n; i++) {
int[] arr = new int[i];
int index = 0, sum = 0;
for (int j = 1; j <= i / 2; j++) {
if (i % j == 0) {
arr[index++] = j;
sum += j;
}
}
if (sum == i) {
System.out.printf("%d its factors are ", i);
for (int k = 0; k < arr.length - 1; k++) {
if (arr[k] != 0)
System.out.print(arr[k] + " ");
}
System.out.println();
}
}
}
}
}
0.0分
0 人评分
简单的a+b (C语言代码)浏览:1103 |
剔除相关数 (C语言代码)浏览:1833 |
点我有惊喜!你懂得!浏览:2071 |
C语言训练-阿姆斯特朗数 (C语言代码)浏览:849 |
校门外的树 (C语言代码)浏览:1113 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:572 |
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:655 |
蓝桥杯历届试题-九宫重排 (C++代码)浏览:2783 |
数组输出 (C语言代码)--此题的题目描述有问题浏览:1814 |
1113题解浏览:784 |