program to print series of prime numbers using java

后端 未结 6 1607
太阳男子
太阳男子 2021-01-25 01:40

This code is to print the series of prime number up to given limit but when I am trying to execute this,it goes into infinite loop.

import java.io.*;
class a
{
          


        
6条回答
  •  礼貌的吻别
    2021-01-25 02:13

    import java.util.*;
    class Prime
    {
      public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
    
        System.out.println("enter  the  no of prime nos want:  ");
        int n2 = sc.nextInt();
        int flag = 1 ;
        int count = 0 ;
        for (int i =2; i<99999;i++ )
        {
             for (int j=2; j

提交回复
热议问题