0% found this document useful (0 votes)
6 views3 pages

Homework 3 4

aahsfv fvujrf

Uploaded by

oracledb53
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Homework 3 4

aahsfv fvujrf

Uploaded by

oracledb53
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

LAB & HW 2

Topics :
 Conditions ( if-else , switch-case ).
 Looping ( while , for , do-while ).

___________________________________________________________________________________

LAB Exercises :

 Write a java program that reads three numbers from the user and print the largest one
?

 Write a java program that reads number of the day within a week and print the name
of that day ? (using Switch).

 Write a java program that prints multiplication table of two ?

 Write a java program that prints multiplication tables of numbers from 1 – 12 ?

 Consider the following investment problem: You put $10,000 into a bank account that
earns 5 percent interest per year. How many years does it take for the account balance
to be double the original ? using
HW :

 Write a java program that reads int number from user and check if this number is even
or odd ?

 Write a program that reads an integer and prints whether it is negative, zero, or
positive ?

 Write a java program to compute the tax as illustrated in the following table:
 Write programs with loops that compute
a. The sum of all even numbers between 2 and 100 (inclusive).
b. The sum of all odd numbers between a and b (inclusive), where a and b are
inputs.
c. The sum of all odd digits of an input. (For example, if the input is 32677, the
sum would be 3 + 7 + 7 = 17.)

 Write a program that reads a word and prints each character of the word on a
separate line. For example, if the user provides the input "Harry", the program prints :
H
A
R
R
Y

 Write a java program that print all prime numbers from 1 to 100 ?

You might also like