Java : Looping Statement - Exercises and Solution


1. Write a program to print all natural numbers from 1 to n

View Solution

2. Write a program to print all natural numbers in reverse

View Solution

3. Write a program to print tables

View Solution

4. Write a program to print reverse tables

View Solution

5. Write a program to print all alphabets from a to z

View Solution

6. Write a program to print reverse alphabets from Z to A

View Solution

7. Write a program to print all even numbers between 1 to 100

View Solution

8. Write a program to print all odd number between 1 to 100

View Solution

9. Write a program to find sum of all natural numbers between 1 to n

View Solution

10. Write a program to find sum of all even numbers between 1 to n

View Solution

11. Write a program to find sum of all odd numbers between 1 to n

View Solution

12. Write a program to print the ASCII values

View Solution

13. Write a program to find the factorial value of any number

View Solution

14. Write a program to find the value of one number raised to the power of another

View Solution

15. write a program to reverse the given Digits

View Solution

16. write a program to sum of its Digits

View Solution

17. write a program to Check Whether a Given Number is Prime or Not

View Solution

18. Write a program to calculate HCF of Two given number

View Solution

19. Write a program to enter the numbers till the user wants and at the end it should display the count of positive, negative and zeros entered

View Solution

20. Write a program to enter the numbers till the user wants and at the end the program should display the largest and smallest numbers entered

View Solution

21. Write a program to find number and sum of all integer between 100 and 200 which are divisible by 9

View Solution

22. Write a program to convert a binary number into a decimal number without using array, function and while loop

View Solution

23. Write a program to check whether a number is a Strong Number or not

View Solution

24. Write a program to convert Hexadecimal to Decimal number system

View Solution

25. Write a Program to convert Hexadecimal to Octal number system

View Solution

26. Write a program to convert Hexadecimal to Binary number system

View Solution

27. Write a program to convert Decimal to Hexadecimal number system

View Solution

28. Write a program to convert Decimal to Octal number system

View Solution

29. Write a program to convert Decimal to Binary number system

View Solution

30. Write a Program to convert Binary to Octal number system

View Solution

31. Write a program to convert Binary to Decimal number system

View Solution

32. Write a program to convert Binary to Hexadecimal number system

View Solution

33. Write a program to convert Octal to Binary number system

View Solution

34. Write a program to convert Octal to Decimal number system

View Solution

35. Write a program to convert Octal to Hexadecimal number system

View Solution

36. Write a program to find 1s complement of a number in java

View Solution

37. Write a program to find 2s complement of a Binary number in java

View Solution

38. Write a program to print fibonacci series upto n terms

View Solution

39. Write a program to check Strong numbers or Not

View Solution

40. Write a program to print All Strong numbers 1 to 100000

View Solution

41. Write a Program to print All perfect numbers 1 to 10000

View Solution

42. Write a Program to check perfect numbers or Not

View Solution

43. Write a Program to print All Armstrong numbers between 1 to 1000

View Solution

44. Write a Program to check Armstrong numbers or Not

View Solution

45. Write a Program to print Prime factors in java

View Solution

46. Write a Program to check Prime numbers or Not

View Solution

47. Write a Program to print Factors of a Positive Integer

View Solution

48. Write a Program to print Factors of a Negative Integer

View Solution

49. Write a Program to Check Given Number is a Palindrome or Not

View Solution

50. Write a Program to Check Given String is a Palindrome or Not

View Solution

51. Write Java program to print bits that need to be flipped to convert a number to another number

View Solution

52. Write Java program to Count the number of bits to be flipped to convert a number to another number

View Solution

53. Write Java program to Round off an integer number to the next lower multiple of 2

View Solution

54. Write Java program to Find the position of MSB bit of an integer number

View Solution

55. Write Java program to Count the total HIGH bits in the given number

View Solution

56. Write Java program to Implement infinite loop using do-while loop

View Solution

57. Write Java program to Implement infinite loop using while loop

View Solution

58. Write Java program to Implement infinite loop using for loop

View Solution

59. Write Java program to Print string in hexadecimal format

View Solution

60. Write Java program to Find the (GCD) Greatest Common Divisor

View Solution

61. Write Java program to Find the (LCM) Lowest Common Multiple

View Solution

62. Write Java program to Extract words from a given sentence

View Solution

63. Write Java program to Print Fibonacci Series

View Solution

64. Write Java program to Find Factorial of a Number

View Solution

65. Write Java program to Generate Random Numbers from 0 to given Range

View Solution

66. Write Java program to Find addition of N integer numbers

View Solution

67. Write Java program to count total number of words in a string

View Solution

68. Write Java program to print used different characters (letters) in a string

View Solution



Basic Programs