Exp10 Writeup-1
Exp10 Writeup-1
Date of Performance :
Date of Submission :
CODE:
#include<stdio.h>
#include<math.h>
void main()
{
int a,b;
void swap (int a, int b);
printf("Enter two numbers:");
scanf("%d %d",&a,&b);
printf("The values of a and b in the main function before calling the swap function are
%d and %d\n",a,b);
swap(a,b);
printf("The values of a and b in main function after calling the swap function are %d
and %d\n",a,b);
}
void swap (int a, int b)
{
int temp;
temp=a;
a=b;
b=temp;
printf("The values of a and b in the swap function after swapping are %d and %d\
n",a,b);
}
OUTPUT:
10b. Write a program to swap two numbers using call by method.
CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
void swap (int *p1, int *p2);
}
void swap (int *p1, int *p2)
{
int temp;
temp=*p1;
*p1=*p2;
*p2=temp;
printf("The values of a and b in the swap function after swapping are %d and %d\
n",*p1,*p2);
}
OUTPUT:
CONCLUSION:
R1 R2 R3 R4 R5 Total Signature
(3 (3 (3 (3 Mark) (3 Mark) (15 Marks)
Marks) Marks) Marks)