Toph easy problem(Making friends)

Question:

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?

Input

The input will contain an integer N (N < 1000000).

Output

Print the number of friends Byang will make in his new class.

Samples

InputOutput
6


Solve in C:

#include<stdio.h>
int main()
{

    int a,count=0,i;
    scanf("%d",&a);
    for(i=2; i<=a; i++)
    {
        if(a%i==0)
            count++;
    }
    printf("%d\n",count);
    return 0;


}

3


No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h ...

Powered by Blogger.