M 7
M 7
Display all
// the odd numbers between 1 to n. 2. Display all the prime numbers between 1
// to n
import java.io.*;
@SuppressWarnings("ALL")
class MyThread implements Runnable {
int i, n;
Thread t1;
MyThread() {
t1 = new Thread(this, "Odd");
t1.start();
}
int count;
Thread.sleep(1000);
for (int i = 1; i <= n; i++) {
count = 0;
Thread.sleep(1000);
if (count == 0) {
System.out.println(i);
}
}
} catch(Exception obj) {
System.out.println(obj);
}
}
}
class m7 {
public static void main(String[] args) throws Exception {
MyThread obj = new MyThread();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Range Value");
obj.n = Integer.parseInt(br.readLine());