Using the Addition operator : Arithmetic Operators « Operator « C Tutorial






#include <stdio.h>

main(){

  int iOperand1 = 0;
  int iOperand2 = 0;
  int iResult = 0;

  printf("\nEnter first operand: ");
  scanf("%d", &iOperand1);
  printf("Enter second operand: ");
  scanf("%d", &iOperand2);

  iResult = iOperand1 + iOperand2;

  printf("The result is %d\n", iResult);

}
Enter first operand: 1
      Enter second operand: 2
      The result is 3








5.2.Arithmetic Operators
5.2.1.Common Arithmetic Operators
5.2.2.Arithmetic operators in action
5.2.3.Using the Addition operator