Print all the prime numbers between 1 and 100 in java by doing coding on mobile
Hey can do your regular programming using your mobile phone ?
Here I am doing coding using my mobile and sharing it to everyone with proper explanation in my blog codeYourslf.
Here you can learn how to print all the prime numbers present in between 1 and 100.
Approach:-1 "print prime numbers from 1 to 100 in java"
public class ptintBetween {
public static void main(String[] args){
int temp = 0;
for(int i = 2; i <= 100; i++)
{
for(int j = 2; j < i; j++)
{
if(i % j == 0)
{
temp = temp + 1;
}
}
if(temp == 0){
System.out.print(i + ", ");
}
else{
temp = 0;
}
}
}
}
Hey please visit my blog codeYourslf to get all types of programs related to java, python, javascript etc with many approaches to solve them.
Please Click Here :-