C language programming> twenty-fifth week ⑥ Please add the function fun. The function of this function is to count the number of prime numbers less than or equal to x (x>2), and the number of prime numbers is returned as the function value.
Example: Please add the function fun. The function of this function is to count the number of prime numbers less than or equal to x (x>2), and return the number of prime numbers as the function value.
#include<stdio.h>intfun(int x){
int i,j,count=0;printf("\nThe prime number between 2 to %d\n",x);for(i=2;i<=x;i++){
for(j=2;j<i;j++)if(i%j==0)break;if(j>=i){
count++;printf(count%15?"%5d":"\n%5d",i);}}return count;}main(){
int x=20,result;
result=fun(x);printf("\nThe number of prime is:%d\n",result);}