TASK DEFINITION: This task is to find the number of 'For' loops present in the given cpp program.
PROBLEM:
int count;

void fun(int i, int j)
{
int k;
for(k=i; k<=sqrt(j); k++) {
if(j%k == 0) {
count++;
fun(k,j/k);
}
}
}
int main()
{
int N,turn,c;
scanf("%d",&turn);
for(c=1;c<=turn;c++)
{
int n,i;
scanf("%d",&n);
for(i=2; i<=sqrt(n); i++) {
if(n%i == 0) {
count++;
fun(i,n/i);
}
}
printf("%d
",count+1);
count=0;
}

}

SOLUTION: 3

PROBLEM: int main()
{
int fun(int m,int n);
int n,i,sum;
scanf("%d",&n);
int *p;
p=(int *)malloc(sizeof(int)*n);
for(i=0;i<n;i++)
scanf("%d",&p[i]);
for(i=0;i<n;i++)
{
sum=0;
sum=fun(p[i],1);
printf("%d
",sum);
}
free(p);
}
int fun(int m,int n)
{
int i,sum=1;
if(n==1)
{
for(i=2;i*i<=m;i++)
{
if(m%i==0)
sum=sum+fun(m/i,i);
}
}
else
{
for(i=n;i*i<=m;i++)
{
if(m%i==0)
sum=sum+fun(m/i,i);
}
}
return sum;
}

SOLUTION: 4

PROBLEM: void main()
{
int ways(int a, int min);
int n,b;
scanf("%d",&n);
while(n-->0)
{
scanf("%d",&b);
printf("%d
",ways(b,2));
}
}
int ways(int a, int min)
{
if(a<min) return 0;
int sum=0,i;
for(i=min;i<=sqrt(a*1.0);i++)
{
if(a%i == 0)
sum = sum + ways(a/i, i);
}
return sum+1;
}

SOLUTION:
1