Input
Number of digits n
Minimum starting at 4, output n ascending numbers
Outputs the sum of the number of mass numbers between any two numbers
3
4
6
12
Out
6
Do not know where is wrong, solve:
#include <iostream>
#include <string>
#include <fstream>
#include <math.h>
using namespace Std;
BOOL Yes (int i)
{
int a=0;
for (a=2; a<=sqrt (i); a++)
{
if (i%a==0)
{
return false;
}
}
return true;
}
int Xunzhao (int a,int b)
{
int counts=0;
for (int c=a; c<=b; C + +)
{
if (yes (c))
{
counts++;
}
}
return counts;
}
int Zhishu (int *arr,int num,int z)
{
int left=0;
int ri=0;
int sum=0;
for (int i=0; i<num-z;i=i+z)
{
Left=arr[i];
RI=ARR[I+Z];
Sum+=xunzhao (Left,ri);
}
return sum;
}
int main ()
{
int num;
cin>>num;
int arr[num+1];
for (int i=0; i<num; i++)
{
cin>>arr[i];
}
int he=0;
for (int a=1;a<num;a++)
{
He+=zhishu (Arr,num,a);
}
cout<
}
To find the number of mass in any two-digit number