Before we study basic building blocks of the C program, let us covered the minimum structure of C program

THE C PROGRAM BASICALLY CONSISTS:-
·         Header file
·         Functions
·         Data types
·         Keywords
·         Variables
·         Statement & Expressions

1] Header file: -
     The first line of program is containing the header file like #include<stdio.h>.
     #include
This is pre-processor directive or command. It is not a part of our program. It is an instruction to the compiler to make it do something. It tells to compile to include contents of file.
o   <stdio.h>
This is the name of the standard library definition file for all standard input, output.
o   <conio.h>
This is the name of the for all Console input / Output function’s.
o   <math.h>
This function is used to all mathematical expressions, like sin, cos, log, etc.

2] Variables:-
A variable is a data name that is used to store a data value. A variable is capable of taking up different values during the execution of the program. A variable name can be chosen such that it has some meaning. This becomes useful during the execution of the program.
Following are rules for constructing variable names:
a.       A variable name is any combination of 1 to 8 alphabets, digits and underscores.
b.      The first character in the variable name should be an alphabet.
c.       No commas or blanks are allowed within a variable name.
d.      No special symbol other than underscore can be used in variable name.
e.       The variable name should not be a keyword.
f.       The variable name is case sensitive.

Variable definition
A variable definition means to tell the compiler where and how much to create the storage for the variable. A variable definition specifies a data type and contains a list of one or more variables of that type as follows:
data_type variable_list;
E.g. int a,b,c;

3] Functions: -
A function is an independent block of statements that perform a specified (logical) task. The specified task is repeated each time the program call the function.
Functions are basically used to break down large computing tasks to smaller ones. They are used for modular development of programs.
Type of Function:-
1.      Library Function
2.      User Defined Function

1.      Library Function:-
These functions are not required to be written by the user because they are provided by “C” & can be include in any program by including the header file.
E.g. printf(); ,scanf(); ,clrscr(); ,getch(); .

2.      User Defined Function :-
It has to be developed by the user at the time of writing a program.
The user defined function:
1.      Needs to be declared
2.      Needs a body
3.      Needs to be called.
Note:- All the function by default return integer type data.
4] Data Types:-
It is defined the set of values that variable can store along with a set of operation that can be performed on that variable.
Type----Storage ------sizeRange
1) Char-----1 byte--------128 to 127 or 0 to 255
2) Unsigned char-----1 byte-----0 to 255
3) Signed char-----1 byte-------128 to 127
4) Int-----2 bytes -----2,147,483,648 to 2,147,483,647
5) Short----2 bytes------32,768 to 32,767
6) Float-----4bytes-----+/- 3.4e +/- 3
5] Key-words:-

All the words that have a predefined meaning in C are called as Key-word. E.g. double, break, else, case, switch, etc. All the Key-words should be written in lower case. Variable of these names cannot be used.
There are the 32 Key-words into the C-programming language. 
They are following:

auto--break--case--const--continue--default--do--double--enum--extern--float--for--goto--if--int--long--register--return--short--signed--sizeof--static--struct--switch--typedef--union--unsigned--void--volatile--char--else--while...
6] Structure of “C” program: -
#include<stdio.h>           // Header file
#include<conio.h>          // Header file
void main()                     // Main function
{                                                                                 
     <variable declaration >;    // Variable declaration
     statement 1;                                                    
     .
     statement N;
     getch();
BASIC C PROGRAM:-

Q. Write a program to print the “Hello Student” on Output screen.
#include<stdio.h>
#include<conio.h>
void main()
{
     printf(“Hello, Student”);

Q. Write a program to calculate the Addition of two numbers.
#include<stdio.h>
#include<conio.h>
void main()
{
       int a,b;
       int sum;          
           a= 11;
           b=10;
       sum=a+b;
       printf(“Addition of number=%d”,sum);
RECEIVING INPUT:-
The program it should ask the user to supply the values of variable through the keyboard during execution. This can be achieved using a function called scanf().

Syntax:-
 scanf(“format specifier”, &variable name);

Note: The ampersand (&) before the variable in the scanf() function is must. ‘&’ is used to get Address of variable. It gives the location number used by the variable in memory.

Q. Write a program to accept the any number from user & print it.
#include<stdio.h>
#include<conio.h>
void main()
{
          int a;
          printf(“\n Enter the any no for printing :”);
          scanf(“%d”,&a);
          printf(“\n Your number is : %d”,a);
}
  ((Arithmetic Operators)): -
1.      Arithmetic Operators: -
Integers, Floating point numbers and double precision numbers can be added, subtracted, divided or multiplied. The operators used for these arithmetic operations are called arithmetic operation.
The arithmetic operators in C include:
Sr no-OPRETERS- [{MEANING}]     
1)     +   -------Add two operands
2)    —  --------Subtract second operand from the first
3)     *   ---------Multiples the both operands
4)     /   ---------Divides numerator by de-numerator
5)    %   ---------(Modulus) division/ remainder of after an integer division
Note: The modulus operator can be used only when both the operands are integers.
         
        ((Relational/Conditional Operators)): -

2.      Relational/Conditional Operators: -
The relational operators allow us to compare two values to see whether they are to each other,
Unequal, or whether one is greater than the other. The operators used in C are as follows:
 
Sr. No.-----Operators----Meaning

1) ---------     ==   -------- Is equal to
2) ---------     != ------Is not equal to
3) ---------     <  ------Is less than
4) ---------    >  ------Is greater than
5) --------    <= ------Is less than or equal to
6) --------   >= ------Is greater than or equal to
       ((Logical Operators)): -
3) Logical Operators: -
Logical operators are used when more than one conditions has to be tested to make a decision. The following are the logical operators used in C:
Sr. No.---Operators-------Meaning
1)   ------------&&-------(AND) It returns true if all conditions are true.
2)    -----------    ||  ------(OR) It returns a true if anyone or many of the conditions are true.
3)   ------------  !  ------(NOT) It returns a true if condition is false &returns false if condition true
        ((Bitwise Operators))
4) Bitwise Operators:-
 Sr. No.------Operators-----Meaning
1)    ----------    &-----------(Binary AND) Copies a bit to the result if it exists in both operands
2)    ---------     |    --------(Binary OR) Copies a bit if it exists in either operand.
3)  -----------    ^   --------(Binary XOR) Copies the bit if it is set in one operand but not both
4) -----------    ~   ---------Binary 1’s complement operator is unary & has the effect of 'flipping’ bits. E.g. A=00001011 after 11110100
5) -----------    <<     ---------Binary left shift operator. E.g. A=00001011 after 00101100
6) -----------    >>     ----------Binary Right shift operator. E.g. A=00001011 after 00000010
      ((Assignment Operators))
 5) Assignment Operators:-
Sr. No.-----Operators------Meaning
1)  ---------   = --------  Assign value from right side to left operand
2)  ----------  += ---------Adds right to left operands & assign result to left operand
e.g. B+=A is equivalent to B=B+A
3)  -----------    -=    Subtracts right from left operands & assign result to left operand
e.g. B-=A is equivalent to B=B-A
4) ----------   *=  ----------Multiplies right with left operands & assign result to left operand
e.g. B*=A is equivalent to B=B*A
5) ----------  /=  ------  divides left with right operand & assign result to left operand
e.g. B/=A is equivalent to B=B/A
6)  ----------  %= -------- take modulus using two operands & assign result to left operand
e.g. B+=A is equivalent to B=B+A
If statement: The general form of it statement is as follows:
Syntax of If Statement:
if(condtion)
{
statements
}
non zero number inside if means "TRUE"
void  main()
{
  int a=40,b=20;
  if (a > b)
  {
      printf("a is greater than b");
  }
}

output:
a is greater than b
IF ELSE STATEMENT: -
If statement: The general form of it statement is as follows:

If the test expression is true then true-statement block will be executed and if the test expression is false then false-statement block will be executed.
syntax:

if(condition)
{
    statements to be executed if condition is true.
}
else
{
    statements to be executed,if condition is false
}
if... else can be used in nested forms,when serious decisions are involved.
syntax:
if (condition) 
    statements to be executed if test expression is true;
 else if(condition) 
    statements to be executed if test expressions 1 is true;
 else if (condition) 
    . . . 
else
     statements to be executed if all test expressions are false;

program:
void  main()
{
  int a=40,b=20;
  if (a == b)
  {
      printf("a is equal to b");
  }

else if( a > b)
{
    printf("a is greater than  b");
}
else
{
printf("a is less than b");
}
}
output:
a is greater than  b