Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

c program for swapping of two numbers using temporary variable

#include <stdio.h>
int main()
{
    int a, b, temp;
    printf("enter the values of a and b: 
");
    scanf("%d%d", &a, &b );
    printf("current values are:
 a=%d
 b=%d
", a, b);
    temp=a;
    a=b;
    b=temp;
    printf("After swapping:
 a=%d
 b=%d
", a, b);
}
 
PREVIOUS NEXT
Tagged: #program #swapping #numbers #temporary #variable
ADD COMMENT
Topic
Name
3+1 =