wu


私信TA

用户名:cncfvc

访问量:215386

签 名:

读研狗没有时间刷题了~~

等  级
排  名 2
经  验 36025
参赛次数 8
文章发表 265
年  龄 25
在职情况 学生
学  校 电子科技大学
专  业 通信工程

  自我简介:

写代码 真好玩 ~

简单的质因数分解
参考代码:

#include<iostream>
using namespace std;
int main()
{
	int n;
	while(cin>>n)
	{
	
		cout<<n<<"=";
		int x=2;
		while(n>1)
		{
			if(n%x==0)
			{
				n=n/x;
				cout<<x;
				if(n!=1)
				cout<<"*"; 
			}
			else
			x++;	
		} 
		cout<<endl;
	}
	return 0;	
}


 

0.0分

3 人评分

  评论区