Computer Science, asked by Ramachandrarao, 10 months ago

write a Java program to print all the prime numbers between 1 to100​

Answers

Answered by pallavi89
6

Answer:

import java.util.*;

Class prime

{

public static void main()

{

Scanner sc =new Scanner(System.in);

int i , j, c=0 ;

for( i=1 ; i<=100; i++)

{

for( j=1 ; j< =i ; j++)

{

if ( i%j ==0)

c++;

}

if ( c==2)

System.out.println( " prime number is " + i);

c=0;

}

}

}

Similar questions
Math, 5 months ago