Module 1: Basic Java Programs

Fundamental Java programs to get started with syntax, I/O, operators, and basic problem solving.

20 program solutions

Back to Topics

Program Solutions

1

Hello World

Print "Hello, World!" on the console using Java.

Beginner
View Solution
2

Add Two Numbers

Read two numbers from the user, add them, and display the result.

Beginner
View Solution
3

Swap Two Numbers

Swap the values of two variables using a temporary variable.

Beginner
View Solution
4

Find ASCII Value of a Character

Read a character and print its ASCII value.

Beginner
View Solution
5

Even or Odd Number

Check whether a given integer is even or odd.

Beginner
View Solution
6

Largest of Two Numbers

Find the largest of two numbers using if-else.

Beginner
View Solution
7

Largest of Three Numbers

Find the largest of three numbers using conditional statements.

Beginner
View Solution
8

Positive or Negative Number

Check whether a number is positive, negative, or zero.

Beginner
View Solution
9

Area of Circle

Calculate the area of a circle given its radius.

Beginner
View Solution
10

Area of Rectangle

Calculate the area of a rectangle given its length and breadth.

Beginner
View Solution
11

Area of Triangle

Calculate the area of a triangle using base and height.

Beginner
View Solution
12

Simple Interest

Calculate simple interest given principal, rate, and time.

Beginner
View Solution
13

Compound Interest

Calculate compound interest using principal, rate, time, and compounding frequency.

Intermediate
View Solution
14

Celsius to Fahrenheit

Convert temperature from Celsius to Fahrenheit.

Beginner
View Solution
15

Sum of N Natural Numbers

Calculate the sum of first N natural numbers using formula.

Beginner
View Solution
16

Power without Math.pow()

Compute a^b using a loop instead of Math.pow().

Beginner
View Solution
17

ASCII to Character

Convert an integer ASCII code to its corresponding character.

Beginner
View Solution
18

Character to ASCII

Convert a character to its ASCII code.

Beginner
View Solution
19

Convert Seconds to Hours and Minutes

Convert total seconds into hours, minutes, and remaining seconds.

Beginner
View Solution
20

Gross Salary Calculation

Calculate gross salary using basic salary, HRA, and DA.

Beginner
View Solution