#include<stdio.h>
int get_factor(int number)
{
int i = 1;
int sum = 0;
while(1)
{
sum+=i;
if(sum == number)
{
return i;break;
}
else if(sum > number)
{
return 0;break;
}
i++;
}
}
int main(void)
{
int number;
int ret;
printf("Enter the number : ");
scanf("%d",&number);
ret = get_factor(number);
if( ret != 0)
{
printf("%d is the factor of the %d",ret,number);
}
else
{
printf("the number dosent have factor");
}
getchar();
getchar();
return 0;
}