#include <stdio.h>
int caluculatefactor(int number);
int checkgreatestfactor(int num);
int main()
{
int num,res;
scanf("%d",&num);
res=checkgreatestfactor(num);
printf("%d ",res);
}
int caluculatefactor(int number)
{
int i=0,maxfactor=0;
for(i=1;i<=number/2;i++)
{
if(number%i==0)
maxfactor=i;
}
return maxfactor;
}
int checkgreatestfactor(int num)
{
if(num==0)
return 0;
else
return (caluculatefactor(num));
}
int caluculatefactor(int number);
int checkgreatestfactor(int num);
int main()
{
int num,res;
scanf("%d",&num);
res=checkgreatestfactor(num);
printf("%d ",res);
}
int caluculatefactor(int number)
{
int i=0,maxfactor=0;
for(i=1;i<=number/2;i++)
{
if(number%i==0)
maxfactor=i;
}
return maxfactor;
}
int checkgreatestfactor(int num)
{
if(num==0)
return 0;
else
return (caluculatefactor(num));
}
input:
100
output:
50
No comments:
Post a Comment