Demo04分解质因数
2024-10-06 02:21:13
package 习题集1;
import java.util.Scanner;
//将一个正整数分解质因数。例如输入90,打印出90=2*3*3*5
public class Demo04 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int count = sc.nextInt();
System.out.print(count + "=");
for (int i = 2;i < count / 2 + 1;i ++) {
if (count % i == 0) {
System.out.print(i + "*");
count = count / i;
i = 1;
}
}
System.out.println(count);
}
}
最新文章
- Design Patterns Simplified - Part 2 (Singleton)【设计模式简述--第二部分(单例模式)】
- [bzoj3670][2014湖北省队互测week2]似乎在梦中见过的样子
- JDIC 访问Web时NullPointerException
- Effective C++ -----条款05:了解C++默默编写并调用哪些函数
- Quartus中添加时序约束
- So easy Webservice 2.WebService介绍
- CF Playing with Paper
- Keil_uvision_4基本使用教程
- 解决从github下载web的源代码部署到eclipse的问题
- Linux命令--链接文件的那些事
- stack around the variable “ ” was corrupted
- java的url 中国的争论导致了扭曲
- JSR-303校验类型
- grafana备份
- Git - 生成 ssh key for Mac
- Java中List的sort排序重写
- YII2常用知识点总结
- SaltStack 和 Ansible 的简单比较
- innerText兼容处理
- [EWS]查找 文件夹