Main method

Structured programming is a style that adopted to programes in early decades. It's easy to learn. Everything will be sequencial. This style of programming is using functions. Functions are some piece of code which can interpret a behaviour. In C programming, we write a main method, which is the entry point to start a program. Below we have demostrated a function which accepts two user inputs and print the result in the screen.


    #include  <stdio.h>

    int main(){
         int firstNumber, secondNumber, sumOfTwoNumbers;

         printf("Enter two integers: ");

         // numbers entered by user will store into those variables respectively
            scanf("%d %d", &firstNumber, &secondNumber);

        // calculate the sum
           sumOfTwoNumbers = firstNumber + secondNumber;

        // display the sum
           printf("%d + %d = %d", firstNumber, secondNumber, sumOfTwoNumbers);

           return 0;
    }