0% found this document useful (0 votes)
15 views

Assignment 1

Uploaded by

gurly101
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Assignment 1

Uploaded by

gurly101
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment -1

1. Write a Java program to change temperature from Celsius to Fahrenheit and vice versa.
2. Write a Java Program to check if a number is Positive or Negative.
3. Write a Java program to find maximum of three numbers.
4. Write a Java program to swap two numbers.
5. Write a Java program to convert miles to kilometers.
6. Write a Java program to check whether a year is leap year or not.
7. Write a Java program for following grading system.Note:
Percentage>=90% : Grade A

Percentage>=80% : Grade B

Percentage>=70% : Grade C

Percentage>=60% : Grade D

Percentage>=40% : Grade E

Percentage<40% : Grade F

8. Write a Java program to check whether a number is divisible by a number given by user.
9. Write a Java program to calculate factorial of 12.
10. Write a Java program for Fibonacci series.
11. Write a Java program to reverse a number.
12. Admission to a professional course is subject to the following conditions:
(a) marks in Mathematics >= 60
(b) marks in Physics >=50
(c) marks in Chemistry >=40
(d) Total in all 3 subjects >=200
(Or) Total in Maths & Physics>=150 Given the marks in the 3 subjects of n (user input)
students, write a program to processthe applications to list the eligible candidates.
13. Write a Java program to calculate the sum of natural numbers up to a certain range.
14. Write a Java program to print all multiple of 10 between a given interval.
15. Write a Java program to generate multiplication table.
16. Write a Java program to find HCF of two Numbers.
17. Write a Java program to find LCM of two Numbers.
18. Write a Java program to count the number of digits of an integer
19. Write a Java program to check whether a number is palindrome or not.
20. Write a Java program to check whether a number is prime or not.
21. Write a Java program to convert a Binary Number to Decimal and Decimal to Binary.
22. Write a Java program to find median of a set of numbers.
23. Write Java programs for the patterns given bellow:
(a) 1
234
56789

(b) 1
212
32123
4321234
24. Write a Java program to calculate Sum & Average of an integer array.

25. Write a Java program to implement stack using array.

26. Write a Java program to implement Queue using array.

27. Write a Java program to enter n elements in an array and find smallest number among
them.

28. Write Java program to find the sum of all odd numbers in a array.

29. Write a Java program to find duplicate elements in a 1D array and find their frequency of
occurrence.

30. Write a Java program to print every alternate number of a given array

31. Write a Java program to show 0-arguments constructor.

32. Write a Java program to show parameterized constructor.

33. Write a class, Commission, which has an instance variable, sales; an appropriate
constructor; and a method, commission() that returns the commission.Now write a demo class
to test the Commission class by reading a sale from the user, using it to create a Commission
object after validating that the value is not negative. Finally, call the commission() method to
get and print the commission. If the sales are negative, your demo should print the message
“Invalid Input”.

You might also like