Concept of JAVA Programming
Concept of JAVA Programming
Assignment 1
B.Tech ECE Batch 2018-2022
Dated: 23/08/2020
1. Write a Java program that takes two numbers as input and display the product of
two numbers.
Test Data:
Input first number: 25
Input second number: 5
Expected Output :
25 x 5 = 125
2. Write a Java program that takes a number as input and prints its multiplication
table upto 10.
Test Data:
Input a number: 8
Expected Output :
8x1=8
8 x 2 = 16
8 x 3 = 24
...
8 x 10 = 80
6. Write a Java program to print an array after changing the rows and columns of a
given two-dimensional array.
Original Array:
10 20 30
40 50 60
After changing the rows and columns of the said array:
10 40
20 50
30 60
7. Write a Java program that will accept an integer and convert it into a binary
representation. Now count the number of bits which is equal to zero of the said
binary representation.
Expected Output:
Input first number: 25
Binary representation of 25 is: 11001
Number of zero bits: 2
8. Write a Java program to accept two string and test if the second string contains
the first one.
Input first string: Once in a blue moon
Input second string: See eye to eye
If the second string contains the first one? false
9. Write a Java program to convert minutes into a number of years and days.
Test Data
Input the number of minutes: 3456789
Expected Output :
3456789 minutes is approximately 6 years and 210 days
10. Write a Java program that accepts two integers from the user and then prints the
sum, the difference, the product, the average, the distance (the difference
between integer), the maximum (the larger of the two integers), the minimum
(smaller of the two integers).
Test Data
Input 1st integer: 25
Input 2nd integer: 5
Expected Output :
Sum of two integers: 30
Difference of two integers: 20
Product of two integers: 125
Average of two integers: 15.00
Distance of two integers: 20
Max integer: 25
Min integer: 5
11. Take three numbers from the user and print the greatest number.
Test Data
Input the 1st number: 25
Input the 2nd number: 78
Input the 3rd number: 87
Expected Output :
The greatest: 87