Top 10 easy programs every beginner should try.

The fundamental requirement of any programming language is to build logic. In this era of internet there are several resources available online to learn any programming language. Each programming language differs in the syntax they require to write a program but the actual need of a programmer is to understand the client/customer requirements and build logic. Here we are listing some of the basic programs a beginner can start with. These programs are easy but requires logical approach. We are providing hint in each program which will help you to understand the requirements and also direct you in the right way.


1. Adding two numbers.

The easiest of all programs is printing “hello world” from where almost all the developers start coding. We are skipping this as there is no logic required in printing “hello world”, it just requires syntax. We will start with Writing a program to add two number taking input from user. Once done with this code, try different operations e.g. subtraction, multiplication, division etc.


Store user input in x and y variable and add them and store the output in variable “result”





2. Swap two numbers.

Declare two variables and assign some values to it. Now the task is to swap the values assigned to these variables. You can take this to next level by avoiding use of third variable.


Store the input in x and y variable



The program output must be




3. Build simple calculator.

This calculator should take input from user and ask the operation to perform. The operation defined should be addition, subtraction, multiplications and division. And based on the selected operator the result should be printed.


Store the numbers in x and y variables

Store the operation in opp variable e.g. (‘+’,’-’,’*’,’/’)

Use if condition to check the type of operator

Example: if opp is equal to ‘+’ then

Result = x+y


4. Calculate area and Circumference of circle.

Radius should be taken as input from user and Area and Circumference should be calculated. After this program you can also write a program to calculate area and perimeter of square, rectangle and triangle.


Area of circle = pi * r*r

Circumference of circle = 2 * pi * r


5. Calculate simple interest.

The next program we can try is to write a code to calculate Simple interest. After this you can also try to write a program to calculate compound interest.


Simple interest = (P*R*T)/100


6. Even and Odd check.

We need to write a program in which a number will be given as input and then we need to perform a check if the number is even or odd. Later we can extend the same logic to print all the even numbers in a range.


If a number is divisible by 2 its even else the number is odd.


Print – 28 is an even number

X = 27

Print – 27 is an odd number


7. Calculate LCM and HCF of two numbers.

In this, two numbers should be taken as input from user and LCM (Least Common Multiple) and HCF (Highest Common Factor) of these two numbers should be printed.


Store the user input in variables x and y and calculate lcm and hcf and store the result in two different variables.


8. Factorial.

Write a program to print factorial of a number.


5! = 5*4*3*2*1 = 120


9. Fibonacci series.

Write a program to print Fibonacci series.


Fibonacci series is a series of numbers in which each number is the sum of the two preceding numbers. Example of an Fibonacci series is as below:

1, 1, 2, 3, 5, 8, etc.


10. Check for prime number.

Check if the number is prime or not. The program should take an input from user and check if the number is prime or not. Later we can extend the same logic to print all the prime numbers in a given range.


If a number is only divisible by 1 and the number itself then the number is prime number.

x= 5

Print – “5 is a prime number”

X = 10

Print – “10 is not a prime number”


We recommend you to try these programs by yourself and if you face any difficulty check the hints provided.

Published : July 6, 2020