BASIC PROGRAMMING CONSTRUCTS

252 programming challenges to help you master the fundamentals of CORE JAVA PROGRAMMING.

1

Write a Java program to print ‘Hello World!’ on screen

2

Write a Java program to print the sum of two numbers

3

Write a Java program that takes two numbers and display the product of two numbers

4

Write a Java program to print the sum, multiply, subtract, divide and remainder of two numbers

5

Write a Java program that takes five numbers as input to calculate and print the average of the numbers

6

Write a Java program to swap two variables

7

Write a Java program to convert a decimal number to binary numbers

8

Write a Java program to convert a binary number to decimal number

9

Write a Java program to check whether Java is installed on your computer or not

10

Write a Java program and compute the sum of the digits of an integer

11

Write a Java program to compare two numbers

12

Write a Java program to count the letters, spaces, numbers and other characters of an input string

13

Write a Java program to print the ascii value of a given character

14

Write a Java program that accepts an integer (n) and computes the value of n+nn+nnn

15

Write a Java program to display the system time

16

Write a Java program to print the odd numbers from 1 to 20

17

Write a Java program to print the even numbers from 1 to 20

18

Write a Java program to convert a string to an integer

19

Write a Java program to convert seconds to hour, minute and seconds

20

Write a Java program to compute the sum of the first 100 prime numbers

21

Write a Java program to swap the first and last elements of an array and create a new array

22

Write a Java program to count the number of even and odd elements in a given array

23

Write a Java program to compute the square root of an given integer

24

Write a Java program to check if a positive number is a palindrome or not

25

Write a Java program to add two numbers without using any arithmetic operators

26

Write a Java program to add all the digits of a given positive integer

27

Java program to find area of circle

28

Java Program to find area of rectangle

29

Java Program to find area of triangle

30

Java Program to find area of equilateral triangle

31

Java Program to find area of rhombus

32

Java Program to find area of parallelogram

33

Java Program to find area of Prism

34

Java Program to find volume of sphere

35

Java Program to find volume of cylinder

36

Java Program to find volume of cuboid

37

Java Program to find volume of cone

38

Java program to find surface area of cuboid

39

Java program to find surface area of cylinder

40

Java program to find surface area of cube

41

Java program to calculate average marks

42

Java program to check vowel or consonant

43

Java program to sum of N numbers

44

Java program to find factorial of any number

45

Java Program to calculate electricity bill

46

Java Program To Calculate CGPA Percentage

47

Java Program to calculate compound interest

48

Java Program To Calculate Batting Average

49

Java Pogram to Calculate Commission Percentage

50

Java Pogram To Find Distance Between Two Points

51

Java Program To Calculate Power Of Number

52

Write a Java program to take three numbers from the user and print the greatest number

53

Write a Java program to find the number of days in a month

54

Write a Java program to test a number is positive or negative

55

Write a Java Program to accept number of week’s day (1-7) and print name of the day

56

Write a Java program that takes a year from user and print whether that year is a leap year or not

57

Write a Java program to input 5 numbers from keyboard and find their sum and average

58

Write a program in Java to display the first 5 natural numbers

59

Write a java program to check vowel or consonant

60

Write a Java program to display the cube of the number upto given an integer

61

Write a Java program to display the n terms of odd natural number and their sum

62

Write a Java program to display the multiplication table of a given integer

63

Write a Java program that reads an integer and check whether it is negative, zero, or positive

64

Write a Java program that reads an positive integer and count the number of digits

65

Write a Java program that accepts three numbers and check All numbers are equal or not

66

Write a java program that accepts three numbers from the user and check if numbers are in “increasing” or “decreasing” order.

67

Write a Java program that determines a student’s grade

68

Write a Java program to create a simple calculator

69

Write a Java program to concatenate two string

70

Write a Java program to convert all characters in a string to lowercase

71

Write a Java program to convert all characters in a string to uppercase

72

Write a Java program to trim a string(remove whitespaces)

73

Write a Java program to get a substring of a given string between two specified positions

74

Write a Java program to replace all the ‘d’ characters with ‘f’ characters

75

Write a java program to get the length of a given string

76

Write a java program to print current date and time in the specified format

77

Write a Java program to get the character at the given index within the String

78

Write a java program to remove a particular character from a string

79

Write a java program to reverse a String

80

Write a java program to remove html tags from a string

81

Write a java program to count total number of lines from a string

82

Write a Java program to sum values of an array

83

Write a Java program to find the index of an array element

84

Write a Java program to calculate the average value of array elements

85

Write a Java program to test if an array contains a specific value

86

Write a Java program to find the maximum and minimum value of an array

87

Write a Java program to insert an element (specific position) into an array

88

Write a Java program to reverse an array of integer values

89

Write a Java program to find the common elements between two arrays

90

Write a Java program to find the duplicate values of an array of integer values

91

Write a Java program to convert an array to ArrayList

92

Write a Java program to add two matrices of the same size

93

Write a Java program to find second largest number from the array

94

Write a Java program to find second lowest number from the array

95

Write a Java program to find the number of even and odd integers in a given array of integers

96

Write a Java program to get the difference between the largest and smallest values in an array of integers

97

Write a Java program to segregate all 0s on left side and all 1s on right side of a given array of 0s and 1s

98

Write a Java program to cyclically rotate a given array clockwise by one

99

java program to print all unique element in an array

100

Write a Java Program to Sort the Array in an Ascending Order

101

Write a Java Program to Sort the Array in an Descending Order

102

Write a Java Program to Sort Names in an Alphabetical Order

103

Write a Java Program to Display Transpose Matrix

104

Write a Java Program to Search Key Elements in an Array

105

Write a Java Program to Accept the Marks of a Student and find Total Marks and Percentage

106

Write a java program to print numbers from 1 to 10 using loop

107

Write a java program to calculate the sum of first 10 natural number using loop

108

Write a Java program to print multiplication table of given number

109

Write a Java program to find the factorial value of any number entered through the keyboard

110

Write a Java program that prompts the user to input an integer and then outputs the number with the digits reversed order

111

Write a Java program that reads a set of integers, and then prints the sum of the even and odd integers using loop

112

Write a Java program to check whether the number is a prime number or not

113

Write a Java program to calculate HCF of Two given numbers using loop

114

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

115

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

116

Write a Java program to print out all Armstrong numbers between 1 to 600 using loop

117

Write a java program to count total number of notes in entered amount using loop

118

Write a Java program to print Fibonacci series of n terms where n is input by user using loop

119

Write a java program to calculate the sum of following series where n is input by user

120

Write a Java method to compute the average of three numbers

121

Write a Java method to find the smallest number among three numbers

122

Write a Java method to count all words in a string

123

Write a Java method to count all vowels in a string

124

Write a Java method to compute the sum of the digits in an integer

125

Write a Java method to check whether an year entered by the user is a leap year or not

126

Write a Java method to calculate the area of a triangle

127

Write a Java method to find the area of a pentagon

128

Write a Java method to find number is even number or not

129

Write a Java method to check numbers is palindrome number or not

130

Write a Java method to displays prime numbers between 1 to 20

131

Write a Java method to find GCD and LCM of Two Numbers

132

Write a Java method to find factorial using recursion in java

133

Write a Java program to reverse an integer number

134

Write a Java program to round a float number to specified decimals

135

Write a Java program to test if a double number is an integer

136

Write a Java program to round up the result of integer division

137

Write a Java program to convert Roman number to an integer number

138

Write a Java program to convert a float value to absolute value

139

Write a Java program to accept a float value of number and return a rounded float value

140

Write a C++ program to print ‘Hello World!’ on screen

141

Write a C++ program to print the sum of two numbers

142

Write a C++ program that takes two numbers and display the product of two numbers

143

Write a C++ program to print the sum, multiply, subtract, divide and remainder of two numbers

144

Write a C++ program that takes five numbers as input to calculate and print the average of the numbers

145

Write a C++ program to swap two variables

146

Write a C++ program to convert a decimal number to binary numbers

147

Write a C++ program to convert a binary number to decimal number

148

Write a C++ program to check whether C++ is installed on your computer or not

149

Write a C++ program and compute the sum of the digits of an integer

150

Write a C++ program to compare two numbers

151

Write a C++ program to count the letters, spaces, numbers and other characters of an input string

152

Write a C++ program to print the ascii value of a given character

153

Write a C++ program that accepts an integer (n) and computes the value of n+nn+nnn

154

Write a C++ program to display the system time

155

Write a C++ program to print the odd numbers from 1 to 20

156

Write a C++ program to print the even numbers from 1 to 20

157

Write a C++ program to convert a string to an integer

158

Write a C++ program to convert seconds to hour, minute and seconds

159

Write a C++ program to compute the sum of the first 100 prime numbers

160

Write a C++ program to compute the square root of an given integer

161

Write a C++ program to check if a positive number is a palindrome or not

162

Write a C++ program to add two numbers without using any arithmetic operators

163

Write a C++ program to add all the digits of a given positive integer

164

C++ program to find area of circle

165

C++ Program to find area of rectangle

166

C++ Program to find area of triangle

167

C++ Program to find area of equilateral triangle

168

C++ Program to find area of rhombus

169

C++ Program to find area of parallelogram

170

C++ Program to find area of Prism

171

C++ Program to find volume of sphere

172

C++ Program to find volume of cylinder

173

C++ Program to find volume of cuboid

174

C++ Program to find volume of cone

175

C++ program to find surface area of cuboid

176

C++ program to find surface area of cylinder

177

C++ program to find surface area of cube

178

C++ program to calculate average marks

179

C++ program to check vowel or consonant

180

C++ program to sum of N numbers

181

C++ program to find factorial of any number

182

C++ Program to calculate electricity bill

183

C++ Program To Calculate CGPA Percentage

184

C++ Program to calculate compound interest

185

C++ Program To Calculate Batting Average

186

C++ Program to Calculate Commission Percentage

187

C++ Program To Find Distance Between Two Points

188

C++ Program To Calculate Power Of Number

189

Write a C++ program to take three numbers from the user and print the greatest number

190

Write a C++ program to find the number of days in a month

191

Write a C++ program to test a number is positive or negative

192

Write a C++ Program to accept number of week’s day (1-7) and print name of the day

193

Write a C++ program that takes a year from user and print whether that year is a leap year or not

194

Write a C++ program to input 5 numbers from keyboard and find their sum and average

195

Write a program in C++ to display the first 5 natural numbers

196

Write a C++ program to check vowel or consonant

197

Write a C++ program to display the cube of the number upto given an integer

198

Write a C++ program to display the n terms of odd natural number and their sum

199

Write a C++ program to display the multiplication table of a given integer

200

Write a C++ program that reads an integer and check whether it is negative, zero, or positive

201

Write a C++ program that reads an positive integer and count the number of digits

202

Write a C++ program that accepts three numbers and check All numbers are equal or not

203

Write a C++ program that accepts three numbers from the user and check if numbers are in "increasing” or “decreasing” order.

204

Write a C++ program that determines a student’s grade (81-100 : A, 61-80 : B, 41-60 : C, 0-40 : D)

205

Write a C++ program to create a simple calculator (1. ADDITION, 2. SUBTRACTION, 3. MULTIPLICATION, 4. DIVISION, 5. EXPONENTIAL, 6. PERCENTAGE, 7. EXIT)

206

Write a C++ program to concatenate two string

207

Write a C++ program to convert all characters in a string to lowercase

208

Write a C++ program to convert all characters in a string to uppercase

209

Write a C++ program to trim a string (remove whitespaces)

210

Write a C++ program to get a substring of a given string between two specified positions

211

Write a C++ program to replace all the ‘d’ characters with ‘f’ characters

212

Write a C++ program to get the length of a given string

213

Write a C++ program to print current date and time in the specified format

214

Write a C++ program to get the character at the given index within the String

215

Write a C++ program to remove a particular character from a string

216

Write a C++ program to reverse a String

217

Write a C++ program to remove html tags from a string

218

Write a C++ program to count total number of lines from a string

219

Write a C++ Program to Accept the Marks of a Student and find Total Marks and Percentage

220

Write a C++ program to print numbers from 1 to 10 using loop

221

Write a C++ program to calculate the sum of first 10 natural number using loop

222

Write a C++ program to print multiplication table of given number

223

Write a C++ program to find the factorial value of any number entered through the keyboard

224

Write a C++ program that prompts the user to input an integer and then outputs the number with the digits reversed order

225

Write a C++ program that reads a set of integers, and then prints the sum of the even and odd integers using loop

226

Write a C++ program to check whether the number is a prime number or not

227

Write a C++ program to calculate HCF of Two given numbers using loop

228

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

229

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

230

Write a C++ program to print out all Armstrong numbers between 1 to 600 using loop

231

Write a C++ program to count total number of notes in entered amount using loop

232

Write a C++ program to print Fibonacci series of n terms where n is input by user using loop

233

Write a C++ program to calculate the sum of following series where n is input by user

234

Write a C++ method to compute the average of three numbers

235

Write a C++ method to find the smallest number among three numbers

236

Write a C++ method to check whether an year entered by the user is a leap year or not

237

Write a C++ program to accept a float value of number and return a rounded float value

238

Write a C++ method to compute the sum of the digits in an integer

239

Write a C++ method to calculate the area of a triangle

240

Write a C++ method to find the area of a pentagon

241

Write a C++ method to find number is even number or not

242

Write a C++ method to check numbers is palindrome number or not

243

Write a C++ method to displays prime numbers between 1 to 20

244

Write a C++ method to find GCD and LCM of Two Numbers

245

Write a C++ method to find factorial using recursion

246

Write a C++ program to reverse an integer number

247

Write a C++ program to round a float number to specified decimals

248

Write a C++ program to test if a double number is an integer

249

Write a C++ program to round up the result of integer division

250

Write a C++ program to convert Roman number to an integer number

251

Write a C++ program to convert a float value to absolute value

252

Create a class entering the command line arguments from the user and show all the arguments as output.