简单的素数判断C程序
仅供学习使用:
/*********************************************
* Name : prime.c
* Purpose : prime (素数判断)
* Author : zimo
* Date : 01/21/2010
* ******************************************/
#include<stdio.h>
int main()
{
int m , n ;
printf("Enter a number: ");
scanf("%d",&n);
for (m = 2 ;m < n ;m++)
if (n % m ==0)
break;
if (m < n)
printf("%d is divisble by %d \n", n , m);
else
printf("%d is prime. \n",n);
return 0;
}
相关文档:
#include <assert.h> //设定插入点
#include <ctype.h> //字符处理
#include <errno.h> //定义错误码
#include <float.h> //浮点数处理
#include <fstream.h> //文件输入/输出
#include <iomanip.h> //参数化输入/输出
#include & ......
Java 2 C++ http://www.javaeye.com/topic/295776
1. 解决性能问题
Java具有平台无关性,这使人们在开发企业级应用的时候总是把它作为主要候选方案之一,但是性能方面的因素又大大削弱了它的竞争力。为此,提高Java的性能就显得十分重要。Sun公司及Java的支持者们为提高Java的运行速度已经做出了许多努力,其中大多数集中 ......
Google Android开发博客今天宣布,即日起开放针对Android平台的原生软件开发SDK下载。由于在SDK前面又加上了原生二字,即Native Development Kit,因此又被Google称为NDK。在此之前,Android平台的第三方应用程序均是依靠基于Java的Dalvik特制虚拟机进行开发的。原生 SDK的公布可以让开发者更加直接的接触Android系统资源, ......
6000甚至10000,都可以,但大于6000,就开始滚屏了。。
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
int i,j,*f,tmp,c=0;
long int n,bits;
const double PI=2*asin(1.0),E=exp(1.0);
scanf("%ld",&n);
bits=(long)ceil(n*(log10(n)-log ......