Skip to content

Commit 6bc120a

Browse files
committed
renamed: from pointer/q1
1 parent d47d916 commit 6bc120a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Pointer Questions/1_odd_or_even.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//WAP to check even or odd numbers using pointer.
2+
3+
#include <stdio.h>
4+
int check(int*);
5+
int main(){
6+
int a;
7+
int *pt = &a;
8+
printf("Enter a number: ");
9+
scanf("%d", &a);
10+
check(pt);
11+
return 0;
12+
}
13+
int check(int *pt){
14+
if(*pt % 2 == 0){
15+
printf("Even\n");
16+
}
17+
else{
18+
printf("Odd\n");
19+
}
20+
return 0;
21+
}

0 commit comments

Comments
 (0)