How to add to integers in c program

 Adding to integers in c

For adding to integers we need two variable for storing value , In this program we are get input from user , for taking input from we need a pre-defined function, that name is scanf.

  • scanf : -  scanf is a pre-defined function , which is used for taking input from users. which syantax is <"%d ", &name> . 
after this we need to another variable , for storing addison value . 

 Now we writte program -----

      // program ---  02 //

  1. #include<conio.h>
  2. #include<stdio.h>
  3. void main()
  4.    int x,y,t;
  5.    clrscr();
  6.    printf("Enter two integer");
  7.    scanf("%d %d", &x,&y);
  8.    t=x+y;
  9.    printf("Answer is %d",t);
  10.    getch();
  11.  }

..Program in pic ------



Output of this program is ---








Comments