-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPractise Programs
More file actions
45 lines (43 loc) · 1.67 KB
/
Practise Programs
File metadata and controls
45 lines (43 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Basics:-
1. Write a Java program to convert temperature from Fahrenheit to Celsius degrees.
Test Data
Input a degree in Fahrenheit: 212
Expected Output:
212.0 degree Fahrenheit is equal to 100.0 in Celsius
2. Write a Java program that reads a number in inches and converts it to meters.
Note: One inch is 0.0254 meter.
Test Data
Input a value for inch: 1000
Expected Output :
1000.0 inch is 25.4 meters
3. Write a Java program that reads an integer between 0 and 1000 and adds all the digits in the integer.
Test Data
Input an integer between 0 and 1000: 565
Expected Output :
The sum of all digits in 565 is 16
4. Write a Java program to convert minutes into years and days
Test Data
Input the number of minutes: 3456789
Expected Output :
3456789 minutes is approximately 6 years and 210 days
5. Write a Java program to solve quadratic equations
Test Data
Input a: 1
Input b: 5
Input c: 1
Expected Output :
The roots are -0.20871215252208009 and -4.7912878474779195
6. Write a Java program to swap two variables
7. Write a Java program to add two binary numbers.
8. Write a Java program to convert an integer number to a binary number.
9. Write a Java program to convert a decimal number to a hexadecimal number.
10. Write a Java program to convert a octal number to a hexadecimal number.
11. Write a Java program to check whether Java is installed on your computer.
12. Write a Java program to display the pattern like a diamond.
13. Write a Java program to display Pascal's triangle.
14. Write a Java program to break an integer into a sequence of digits.
Test Data
Input six non-negative digits: 123456
Expected Output :
1 2 3 4 5 6
15. Write a Java program to check if two strings are anagrams or not.