java program Page 118-119
java program Page 118-119
1. import java.util.Scanner;
import java.util.Scanner;
import java.util.Scanner;
import java.util.Scanner;
OUTPUT
Output
7.Write a program to input the time in seconds. Display the
time after converting them into hours, minutes and seconds.
Sample Input: Time in seconds 5420
Sample Output: 1 Hour 30 Minutes 20 Seconds
import java.util.Scanner;
Output
8.Write a program to input two unequal numbers. Display
the numbers after swapping their values in the variables
without using a third variable.
Sample Input: a = 23, b = 56
Sample Output: a = 56, b = 23
import java.util.Scanner;
Output
9.A certain amount is invested at the rate 10% per annum
for 3 years. Find the difference between Compound Interest
(CI) and Simple Interest (SI). Write a program to take
amount as an input.
Hint: SI = (P * R * T) / 100
A = P * (1 + (R/100))T
CI = A - P
import java.util.Scanner;
Output