Java Strings, Arrays, Number Programs
Java Strings, Arrays, Number Programs
Number Theory:
1. Print bigger number from 2 given numbers.
10. Find out sum of all even numbers between two given numbers?
11. Print java for multiples of 4 and print j2ee for multiples of 5 and if number is
multiple of 4 and also 5, then print lara. Continue till to 100.
12. Find out whether digits are in raising order or not in a given numer?
rd
13. Swap two int variables without 3 variable?
14. Find out total digits of a given number?
18. Assume total number of digits in a given number is even. Reverse only first
half of the given number
19. Assume given number containing 3 digits. now check it out first two digits
rd
sum is 3 digit or not?
24. Develop a program to print prime numbers between two given numbers?
27. Develop a program to print sum of prime numbers between two given
numbers?
28. Develop a program to print prime numbers in the reverse order from 70 to 20?
29. Develop a program to print prime numbers which are immediately after
multiples of 10 and bellow 200.
30. Develop a program to print prime numbers which are just before multiples
of 10 and bellow 200.
31. Develop a program to print 30 prime numbers which are having digits in
the raising order after 10. (Example: 13, 17, 19, 23, 29, 37, 39, 47,……)
32. Develop a program to print 30 prime numbers which are having digits in the
descending order after 10. (Example: 31, 41, 43, 51, 53, 61, 71, 73, ,……)
37. Print Fibonacci series in the reverse order from 5000 to 500?
38. Print immediate next number in the Fibonacci series? Consider till to 5000
39. Print all prime numbers only from the Fibonacci series? Continue till to 5000
47. Assume given number containing even number of digits. Reverse only
nd
2 half of the number?
123 -> 6
67 -> 13 -> 4
49. Move first half to second and second half to first? (total digits
are even) Ex: 123456 convert to 456123,
ARRAYS:
7. Find out the sum of all even indexed elements from a given int array?
8. Find out the sum of all odd indexed elements from a given int array?
9. Find out the min value from all even indexed elements from a given int array?
10. Find out the max value from all odd indexed elements from a given int array?
11. Find out the avg value from all even indexed elements from a given int array?
12. Find out the avg value from all odd indexed elements from a given int array?
13. Find out the sum of all elements from a first half of given int array?
14. Find out the sum of all elements from a second half of given int array?
15. Find out the min value from a first half of given int array?
16. Find out the min value from a second half of given int array?
17. Find out the max value from a first half of given int array?
18. Find out the max value from a second half of given int array?
19. Find out the avg value from a first half of given int array?
20. Find out the avg value from a second half of given int array?
22. Read first half of the elements in the reverse direction from an array?
23. Read second half of the elements in the reverse direction from an array?
25. Read only even indexed elements from an array in the reverse order?
27. Read only odd indexed elements from an array in the reverse order?
35. Swap odd indexed elements with its immediate next even indexed
elements of given array?