Pages

Monday, November 9, 2015

c program for addition of 2 nos without using 3rd variable

// c program for addition of 2 nos without using 3rd variable
#include<stdio.h>
void main()
{
   int a = 1, b = 2;
 
   /* Storing result of addition in variable a */
 
   a = a + b;
 
   /** Not recommended because original value of a is lost  
    *  and you may be using it somewhere in code considering it 
    *  as it was entered by the user. 
    */
 
   printf("Sum of a and b = %d\n", a);
 }

No comments:

Post a Comment