Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

1=> A function is a block of code that perform particular task.

Here’s a C program that takes input and check whether


it’s odd or even:

#include <stdio.h>

// Function to check if a number is even or odd


int isEven(int num) {
if (num % 2 == 0) {
return 1;
} else {
return 0;
}
}

int main() {
int num;

printf("Enter an integer: ");


scanf("%d", &num);

if (isEven(num)) {
printf("%d is even.\n", num);

You might also like