C Program to Print Addition of Two Numbers

Ex: Write a C program to print addition of two numbers. How to write a C program to print addition of two numbers. C program to print addition of two numbers.

Input from user:

Enter the number 1: 
10
Enter the number 2:
20

Expected Output:

Addition of two numbers is =30.





Step by step logic to print addition of two numbers:

1. First we will take two   Number's from user say    no1, no2.

2. After that we will perform addition of two numbers.

3. We will store this addition in third variable say no3

4. After that we will display Addition means no3 on the output screen.






Program:

#include<stdio.h>
void main()
{
      int no1,no2,no3;
      printf("Enter the number 1:\n");
      scanf("%d",&no1);
      printf("Enter the number 2:\n");
      scanf("%d",&no2);

     no3=no1+no2;
     
     printf("Addition of two numbers is = %d",no3);

}

Above program will show the following output:

C Program to Print addition of two numbers

How to Declare and Initialize Variables in C

Variable:- In simple words variable is the name given to the memory location where costant value is stored. Means variable is an identifier assign to the memory location where data is stored.


    Rules For Declaring C Variables:

  • Variable names must begin with letter or underscore.
  • Variables are case-sensitive and they can be constructed with digits, letters.
  • We cannot use special symbols other than underscore.
  • We cannot start variable name with number.
   For Example:    int 1a, 2b;

   Right way is:     int a1, b2;



    How to declare the variables:


Syntax:

datatype variable_name;
{
     // Block of code
}


For Example:

int a,b,c;// here int is datatype and a,b,c are variables.

Let's understand with another  example's:

float x,y; // here float is datatype and x,y are variables.

char name; // here char is datatype and name is variable name.



    How to initialize the variables in C:


Syntax:

datatype variable_name = value;


For Example:

int num = 10; // here, int is datatype, num is variable and 10 is value.

float a = 5.4; // here, float is datatype, a is variable_name and 5.4 is value.


char gender = 'M'; // here, char is character datatype, gender is variable_name and M is value.


What is Programming Language

What is programming: Before learning the programming language first you need to know what is the programming language and what is the use of programming language's . 
                       

  What is the definition?

The process of implementing and developing various sets of instructions to enable a computer to do or perform a certain task's.. is called as programming...

  What is the programming language used for?

Programming language is used to communicate with the computer's. It is used to create instructions to operate computers and Software's successfully. 

  What are the examples of some famous programming languages?


There are so many programming languages in
programming world such are.. C/C++/Java/Python/Ruby /HTML and CSS is used for designing etc.