Tuesday 17 November 2015

java lab@3


1.Write a program to display all the prime numbers from 1 to 20.

Ans.





Q 2. Write a program to check if the first number is divisible by the second number or not.
In addition, display approprate message accordingtothe result..

Ans.

public class DivisibleChecker {
  
  public static void main(string [] args) {

   int num1, num2;
   num1 = 32;

   num2 = 12;

   if (num1 % num2 == 0) {
        System.out.println("The first number is divisible by the second number");
   } else {
    System.out.println("The first number is not divisible by the second number");
   }
  }
 }



2.Write a program to check if the first number is divisible by the second number or not. In addition, display appropriate messages according to the result.

Ans.


3.Write a program to print the table of five.

Ans.
public class table {

  public static void main(String [] args)
  int result;
  
   for (int i = 1; i <=10; i++) {
    result = i * 5;

  system.out.println("5 * " + i " = " + result);

   }
 }

 } 

4.Write a program that will store the employee records, such as employee ID, employee name, department, designation, date of joining, date of birth, and marital status, in an array. In addition, the stored record needs to be displayed.



1 comment:

  1. Niit Lab: Java Lab@3 >>>>> Download Now

    >>>>> Download Full

    Niit Lab: Java Lab@3 >>>>> Download LINK

    >>>>> Download Now

    Niit Lab: Java Lab@3 >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete