1.) Program to swap the value of three variable without using fourth variable.

 

// program to swap the value of three variable without using fourth variable.
#include <conio.h>
#include <stdio.h>

int main()
{
    int a, b, c;
    printf("Enter the value of a,b,c:\n");
    scanf("%d%d%d", &a, &b, &c);
    a = a + b + c;
    c = a - (b + c);
    b = a - (b + c);
    a = a - (b + c);
    printf("The value of a,b and c after interchange is
\na = %d,\nb = %d,\nc = %d", a, b, c);
    return 0;
}

Output:
Enter the value of a,b,c: 8 9 10 The value of a,b and c after interchange is a = 9, b = 10, c = 8
***** THANK YOU *****

Comments

Popular posts from this blog

18 Amazing programs in C.