文章来源:https://www.toymoban.com/news/detail-465559.html
#include<stdio.h>
#include<math.h>
int main()
{
int N;
int maxString = 0;
int count = 0;
int num = 0;
int firstNum = 0;
if (scanf("%d",&N)!=EOF){
int i;
for(i = 2; i <= sqrt(N); i++)
{
num = N;
count = 0;
int j = i;
while(num%j == 0)
{
num = num/j;
j++;
count++;
}
if(count > maxString)
{
maxString = count;
firstNum = i;
}
}
if(maxString)
{
//判断是否存在连续数
printf("%d\n",maxString);
int i;
for(i = 0; i < maxString; i++)
{
printf("%d",firstNum + i);
if(i != maxString-1)
{
printf("*");
}
}
}
else
{
printf("1\n%d",N);
}
}else{
printf("input wrong");
}
return 0;
}
代码来自:https://yunjinqi.top/article/209文章来源地址https://www.toymoban.com/news/detail-465559.html
到了这里,关于c语言编程练习题:7-84 连续因子的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!