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.
bhai last vala khaa h
ReplyDelete