JAVA PROGRAMS WORKSHEET 3
1. Write a Java program to print 'Hello' on screen and your name
on a separate line.
2. Write a Java program to print the sum of two numbers.
Test Data:
74 + 36
3. Write a Java program to divide two numbers and print them on
the screen.
Test Data :
50/3
4. Write a Java program to print the results of the following
opera ons.
Test Data:
a. -5 + 8 * 6
b. (55+9) % 9
c. 20 + -3*5 / 8
d. 5 + 15 / 3 * 2 - 8 % 3
5. Write a Java program that takes two numbers as input and
displays the product of two numbers.
Test Data:
Input first number: 25
Input second number: 5
6. Write a Java program to print the sum (addi on), mul ply,
subtract, divide and remainder of two numbers.
Test Data:
Input first number: 125
Input second number: 24
7. Write a Java program that takes a number as input and prints its
mul plica on table up to 10.
Test Data:
Input a number: 8
Expected Output :
8x1=8
8 x 2 = 16
8 x 3 = 24
...
8 x 10 = 80
8. Write a Java program to display the following pattern.
Sample Pattern :
J a v v a
J a a v v a a
J J aaaaa V V aaaaa
JJ a a V a a
9. Write a Java program to compute the specified expressions and
print the output.
Test Data:
((25.5 * 3.5 - 3.5 * 3.5) / (40.5 - 4.5))
10. Write a Java program to print the area and perimeter of a circle.
Test Data:
Radius = 7.5