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 人评分
C语言程序设计教程(第三版)课后习题11.8 (C语言代码)浏览:622 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:592 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:596 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:616 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:607 |
1051(奇了怪了)浏览:649 |
敲七 (C语言代码)浏览:2701 |
排序算法(选择,插入,冒泡)浏览:775 |
简单的a+b (C语言代码)浏览:647 |
求圆的面积 (C++代码)浮点数有误差!!!浏览:675 |