Write a program to print all prime numbers between 1 and 100 in java with output
Answers
Answered by
1
Answer:
Explanation:
class Prime. {
public static void main(String arg[]) {
int i,count; System. out. print("Enter n value : ");
Scanner sc=new Scanner(System. in); int n=sc. nextInt();
System. out. println("Prime numbers between 1 to "+n+" are "); for(int j=2;j<=n;j++)
{ count=0;
for(i=1;i<=j;i++) {
if(j%i==0) {
Answered by
0
Explanation:
hope this answer helps you.
happy learning ✌️☺️✌️❤️
Attachments:
Similar questions