-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnumberSwap.c
More file actions
31 lines (25 loc) · 750 Bytes
/
Copy pathnumberSwap.c
File metadata and controls
31 lines (25 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/********************************************************************************
* Name :grade of student
* Author :Prapanch J
* Description :c- Program
* Version :1.0
* Date :/10/23
* ******************************************************************************/
#include <stdio.h>
void swapNum(int *a, int *b){
int temp;
temp = *a;
*a = *b;
*b = temp;
}
int main() {
int num1, num2;
printf("Enter two numbers: ");
scanf("%d %d", &num1, &num2);
int *a = &num1, *b = &num2;
printf("First number is %d\nSecond number is %d\n", *a, *b);
swapNum(a, b);
printf("Swapped numbers successfully\n");
printf("First number is %d\nSecond number is %d\n", *a, *b);
return 0;
}