Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class A extends Thread{
- int n;
- A(int n){
- this.n = n;
- }
- public void run(){
- for(int i = 1; i<n; i++)
- System.out.println("\n"+i+"*300="+(300*i));
- yield();
- }
- }
- class B implements Runnable{
- int n;
- B(int n){
- this.n = n;
- }
- public void run(){
- long a = 0, b = 1, sum, t;
- System.out.println("\t"+a);
- System.out.println("\t"+b);
- for(int i = 0; i<n-2; i++){
- sum = a + b;
- System.out.println("\t"+sum);
- t = b;
- b = sum;
- a = t;
- }
- }
- }
- class testHello{
- public static void main(String[] args){
- Scanner sc = new Scanner(System.in);
- System.out.print("Enter the limit for the Multiplication: ");
- int n1 = sc.nextInt();
- System.out.print("Enter the limit of Fibonacci Series: ");
- int n2 = sc.nextInt();
- while(n2 <= 100){
- System.out.print("The limit should be more than 100: ");
- n2 = sc.nextInt();
- }
- new A(n1).start();
- new Thread(new B(n2)).start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement