Making Friends
Limits
1s, 512 MB
Byang is going to join a new school. His new class has N students.
Each of the students are identified by their roll numbers starting from 1 to N. Byang is going to get the next roll number in the sequence.
Byang plans to make friends with only those whose roll numbers are a divisor of his roll number.
Can you help Byang count how many friends he will make?
Each of the students are identified by their roll numbers starting from 1 to N. Byang is going to get the next roll number in the sequence.
Byang plans to make friends with only those whose roll numbers are a divisor of his roll number.
Can you help Byang count how many friends he will make?
Input
The input will contain an integer N (N < 1000000).
Output
Print the number of friends Byang will make in his new class.
#include<stdio.h>
int main()
{
int count=0,n,i;
scanf("%d", &n);
i=1;
while(i<n)
{
if(n%i==0)
{
count++;
}
i++;
}
printf("%d\n",count);
return 0;
}