How to jumpstart learning c programming language in the most easiest way


This is an informative article on how to get started with c programming. The most easiest way to start learning a new programming language is by writing a simple program, such as leap year program.

The leap year program in c is the most simplest of all the programs, and will help you in understanding the basic concepts of the language.

Initially, you need to know what exactly is a leap year or in other words which years are leap years and which are not.

A leap year is defined as one that is divisible by 4, unless it’s also divisible by 100 but not 400. For example, 1900 was not a leap year but 2000 was.

In this program you need to check whether a given year is a leap year or not.

You should first declare an integer variable for storing your input value (year) and then take an input from the user using scanf() function.

After that, use if-else condition to check whether the number entered by the user is divisible by 4, 100 and 400 or not. If it is then print the output “Leap Year”, else “Not Leap Year”.

This program can be written in different ways with different techniques used to solve this problem.

Since C is a structured programming language, we need to divide the program in smaller parts i.e. functions.

The main () function is the entry point of the program. The operating system transfers control to this function when the program starts executing.

As you can see, the parentheses after main () are empty. In C, you can pass parameters (values) to a function through these parentheses, but in this case there is none. This is known as no argument or void argument list (void means nothing).

You will learn more about functions later on in this tutorial. Let’s get back to our program and examine it line-by-line:

First, we declare two variables of type int. These variables are named year and rem_4, respectively. They will be used to store a year and its remainder when divided by 4.


Leave a Reply

Your email address will not be published.