Detailed Instructions: This task is to find the number of 'For' loops present in the given cpp program.
See one example below:
Problem: main()
{
      float a[4];
      float k;
      float c;
      int i;
      for(i=0;i<4;i++)
      {
                      scanf("%f",&a[i]);
      }
      scanf("%f",&c);
      c=2*3.1415926*c/360;
      k=(a[0]+a[1]+a[2]+a[3])/2;
      double s,sq;
      sq=(k-a[0])*(k-a[1])*(k-a[2])*(k-a[3]) - a[0]*a[1]*a[2]*a[3]*(double)cos(c/2)*(double)cos(c/2);
    
      if(sq<0)
      printf("Invalid input");
      else
      {
          s=sqrt(sq);
          printf("%.4f",s);
      }
    
}

Solution: 1
Explanation: The number of 'for' loops in the code is given by the number of 'for' string present in the code. Since we can find the exact number of for loops, this is a good example.

Problem: int sum=0;//???????????
void fact(int a,int i)//?????;??????????a?????i?????
{
    if(a==1) sum++;//???????N=1????????N????????1
    while(i<=a)//????i???N
    {
        if(a%i==0) fact(a/i,i);//??N??i?????????????N/i??
        i++;//??N???i???i?1
    }
}
int main()//???
{
    int n;//?????????
    cin>>n;//??????
    while(n--)//??
    {
        int a;//??????????
        cin>>a;//????
        int i=2;//???????2?
		int result=1;//????????a??????
        while(i<=a/2)//??i???a???
        {
            if(a%i==0)//??i?a???
            {
                sum=0;//sum??
                fact(a/i,i);//????????/i
                result+=sum;//????????i????
            }
            i++;//i?1
        }
        cout<<result<<endl;//??????
    }
    return 0;
}

Solution:
0