print prime numbers from 1 to 100 in java using switch case
Answers
Answered by
5
import java.util.*;
class prime_num
{
public void main(String args[])
{
int i=0, num=0, n;
for(i=1;i<=100;i++)
{
for(num=i;num>=1;num--)
{
if(i%num==0)
n=n+1;
}
if(n==2)
}
System.out.println("Prime num from 1 to 100 are: "+n);
}
}
class prime_num
{
public void main(String args[])
{
int i=0, num=0, n;
for(i=1;i<=100;i++)
{
for(num=i;num>=1;num--)
{
if(i%num==0)
n=n+1;
}
if(n==2)
}
System.out.println("Prime num from 1 to 100 are: "+n);
}
}
Pixelpit:
Buckwas he
Similar questions