将一个正整数分解质因数。例如:输入90,打印出90=2*3*3*5

求代码

qq_森林_3
浏览 2229回答 1
1回答

狼顾之相1995

include<);%d"printf("while(n%i>, &n);n/;i=2;1){if(n%i==0){if(c>0)printf("return 0;using namespace std;x"} elsei++;c++;printf(";%d="int main(){int n;=i;0)printf("}if(c>%d", i),i=2;i>, c=0, i), n);x");scanf("printf(";0 || n/%d"stdio.h>解决方案2:if(temp == 1) break; i <#include<< num < i++){if(temp % i == 0) {temp = temp /cout <);}}system(";< "<using namespace std; "pause" = " i; i;;int main() {int num; cout <for(int i = 2;cout <i = 2;*" num;cin >>int temp = num;return 0;<= temp;iostream>
打开App,查看更多内容
随时随地看视频慕课网APP