In this example I wrote a program to check whether the given number is even or odd using revursive function in C program code
C Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#include<stdio.h> #include<stdlib.h> void isEvenNum(int number); // function prototype void main() { int num; printf("Enter an integer: "); scanf("%d", &num); isEvenNum(num); system("pause"); } void isEvenNum(int number) // function definition { if(number%2==0) printf("%d is an even number\n",number); else printf("%d is not an even number\n",number); } |