Completely Solved C, C++ Programs Assignment.




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

Filed Under:

Problem 97. C Program to accept two numbers and interchange two values using functions.
#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);
}

C compiler: gcc 4.1.2

 Back to main directory: Sample C Program | Software Practical | Solved C Assignment


Get Free Programming Tutorials and Solved assignments