Monday, 18 June 2018

Program to find out the swap of two variable in C using function

/* swap of variables */
# include <stdio.h>
void swap (int , int) ;
void main ()
{
int a,b ;
clrscr () ;
printf ("\n Enter value of a:") ;
scanf ("%d", & a) ;
printf ("\n Enter value of b:") ;
scanf ("%d", & b) ;
swap (a,b) ;
getch () ;
}
void swap (int a , int b)
{
int temp ;
temp = a ;
a = b ;
b = temp ;
printf ("\n a = %d", a) ;
printf ("\n b = %d", b) ;
}


No comments:

Post a Comment

Featured post

Program to find Volume of given box in java

class volume { public static void main (String args []) { int l=5,b=6,h=10; int volume; volume=l*b*h; System.out.println (" vol...