C语言中定义的函数输出为一组数据,在主函数中想要调用此函数的结果应该怎么写代码?

#include <stdio.h>
void Allfactors(int n)
{
int i;
for(i=1;i<=n;i++)
{
if(n%i==0)
printf("%d\t",i);
}
}//这里定义了一个求某整数所有约数的函数 应该没错 单独运行可以输出//
void main()
{
int a;
printf("Please input an int:\n");
scanf("%d",&a);
printf("Your int is:\n");
int n;
n=Allfactors(a);//从这里开始不会了 我想调用这个输出约数的函数 应该怎么写啊 这么写不对 //
printf("the factors of your number are:%d\n",n);

}
木有财富值了。。求帮忙。。。。

#include <stdio.h>
int Allfactors(int n)
{
int i;
for(i=1;i<=n;i++)
{
if(n%i==0)
printf("%d\t",i);
}
printf("\n");
return i;
}//这里定义了一个求某整数所有约数的函数 应该没错 单独运行可以输出//
void main()
{
int a;
printf("Please input an int:\n");
scanf("%d",&a);
printf("Your int is:\n");
int n;
n=Allfactors(a);//从这里开始不会了 我想调用这个输出约数的函数 应该怎么写啊 这么写不对 //
printf("the factors of your number are:%d\n",n);
}
试试这个?
温馨提示:答案为网友推荐,仅供参考