Program to accept two numbers and interchange two values using functions - 100 Most Important C# Programs

97. Program to accept two numbers and interchange two values using functions.

Code:

#include<conio.h>

#include<stdio.h>

void swap (int a, int b);

main( )

{

int a,b;

clrscr( );

printf(“enter value for a;”);

scanf(“%d”,&a);

printf(“enter value for b;”);

scanf(“%d”,&b);

swap(a,b);

getch( );

}

void swap(int a,int b)

}

int c;

c=a;

a=b;

b=c;

printf(“\na=%d”,a);

printf(“\nb=%d”,b);

}