1. Topic content :
Twin prime refers to the interval of 2 Adjacent prime of , For example, the smallest pair of twin prime numbers is 3 and 5,5 and 7 Also (5 Repeated but counted as 2 group ).

2. Input format :
input N, find 2 to N Group number of twin prime numbers between .

Pay attention to the input here N Don't exceed int Indicates the maximum range of

3 Output format :

output 2 to N Twin prime between , Then output the number of groups .

The code is as follows :
#include<stdio.h> int Function(int n)// Function to determine whether it is a prime number { for (int i=2; i<n; i++) { if
( n%i == 0 ) return 0; } return 1; } int main(void) { int N; int count=0;
//count Number of storage groups scanf("%d",&N); for(int i=2; i<=N; i++) { if(Function(i)==1 &&
Function(i+2)==1)// judge i and i+2 Are they both twin prime numbers { printf("%5d and %5d It's a twin prime \n",i,i+2); count++;
// Number of groups +1 } } printf("\n Total %d Group twin prime ",count); return 0; }

Technology