Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

COMPUTER PROGRAMMING LAB PRACTICAL for CORE JAVA

1. Write a Java Program to prompt user to Enter 2 numbers and calculate their difference
2. Write a program to take four integer values as input and print the average.
2. Make a program which reads three integers and display the largest
3. Write a program the read an integer number and display its absolute value
4. Write a program using array to read the ten integer numbers and find the Counts for number of
positive and negative numbers.
5. Consider the weekly salary of a girl who is selling the domestic products , if the number of
product sold in a week , her salary is given by
3x+100 if X<40
300 if X=40
4.5X+150 if X>40
Write a program to find her salary
6. Write a program to reverse the given integer number.
(E.g. input: 2356, the reverse is 6532)
7. Make a program to get the following output:
(A)
1
12
123
1234
12345
123456
(B)
1
22
333
4444
55555
666666
1

COMPUTER PROGRAMMING LAB PRACTICAL for CORE JAVA


8. Write a program which reads the marks of student and display the grades according to the
following table
Mark

Grade

[9,10[

ELITE

[8,

GRAND DISTINCTION

[7,

DISTINCTION

[5,6

SATISFACTION

[3,4

PASSABLE

ELSE

FAIL

A) USE IF structure B) user Switch Case

10. Write programme to display the following series:


a) 1 3 5 7 9 ..N,
b) 40,35,30, N
N is an Integer number received form the Keyboard
ASSIGNMENT:
11. Write a program to exchange US dollar in Rwandan Francs and Vise Versa, use switch case.
12. Write programme to print all prime integer numbers between a unit and N integer number
received form Keyboard.
Use Do-while loop.
13. Write programme to calculate the average not of students marks and display the marks
which are less than the average.
14. Write programme to read 10 integer numbers into a vector
with one dimension and
U
display them in A) Ascending order B) Descending Order
15. Write programme that initialise10 integer numbers into a vector
with one dimension
U
and display them
The program must be able to A) Delete an element from a specific position B) Insert new
element as specific position
16. Use 4 functions to computer the four mathematic operators for two floating point numbers.
17. Write a function Fibonacci ( n ) that calculates the nth Fibonacci number
2

You might also like