Write a program to print all the prime numbers between 1 and 100.
52 Likes
public class KboatPrime { public static void main(String args[]) { for (int i = 1; i <= 100; i++) { int c = 0; for (int j = 1; j <= i; j++) { if (i % j == 0) c++; } if (c == 2) System.out.println(i); } } }
Answered By
22 Likes
Generate the following series upto 10 terms:
1, 4, 7,10 ……
0, 3, 8, 15, 24, 35 …..
Write a Java program using the switch case to print the corresponding days of numbers.
For example: 1= Monday…. 7 = Sunday
Write a program to print the largest of three numbers.