本帖最后由 java2000_net 于 2008-08-05 19:01:38 编辑

解决方案 »

  1.   

    再贴一次吧  呵呵  最喜欢复制粘贴了...
    public class FindPrime { 
    public static void main(String args[]){ 
    int i,j;
    int count = 0;

    for(i=2;i<=100;i++){ 
    for(j=2;j<=Math.sqrt(i);j++){ 
    if(i%j == 0) 
    break; 

    if(j > Math.sqrt(i)){ 
    count ++;
    System.out.print(i +" ");
    }

    System.out.print("\nThere are "+ count +" prime numbers.");

    }[code=Java]
    2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 
    There are 25 prime numbers.[/code]