You are on page 1of 1

JAVA

CLASS-8
1. Write a program to declare the name of a city and its
capital. Print the following-
The capital of…………………..is……………………
2. Write a program to declare the name of a student and
her marks in three subjects. Calculate and print her
average marks and name. 55,78,90
3. Write a program to display the names of five fruits with
a single System.out.println();
Statement, but in different lines.
4. Write a program to find the sum, difference and product
of 12.35 and 7.3 using variables with a single
System.out.println (); statement, however with \n \t
horizontal tab space in the result.
5. Write a program using float type variables to find the
area and perimeter of a square whose
Side is 12.5 cm.
6. Write a program using variables to find the profit and
profit percent of a certain transaction
where S.P.=₹ 10000 and C.P.=₹ 7000.
7. Write a program to initialize three int variables a, b and
c with 234, 456 and 712 and store the sum of the last
digits of the variables into d and display it.
8. Write a program to initialize an int variable a with 76498
and from it extract the first digit and store it into a
variable f and extract the last digit into a variable e and
display both these digits.

You might also like