您的位置:首页 > 移动开发 > 微信开发

判断素数的个数的小程序

2015-10-12 20:06 429 查看
输入n,判断不超过x的素数的个数最大是多少,所以有可能出现输入20,输出27点多。

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
using namespace std;
#define e 2.718281828459

int main(){
double n;

while(scanf("%lf",&n)!=EOF){
//double temp1=log10(2)/log10(e);
//double temp2=log10(n)/log10(e);

//printf("%lf %lf\n",temp1,temp2);
printf("%lf\n",6*(log10(2)/log10(e))*n/(log10(n)/log10(e)));
}

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: