top of page
Search

C program to swap two numbers without using temporary variable

#include <stdio.h>


void main()

{

int a,b,temp;

printf("Enter the values of a and b\n");

scanf("%d%d",&a,&b);

a=a-b;

b=a+b;

a=b-a;

printf("After Swapping a=%d\n",a);

printf("After Swapping b=%d\n",b);

}

 
 
 

Recent Posts

See All

Comments


Post: Blog2_Post

©2020 by Fundamentals of computing. Proudly created with Wix.com

bottom of page