Write a function that check if a number is odd.


Difficulty level
This exercise is mostly suitable for students
#include<stdio.h>
#include<conio.h>

int isOdd(int nb)
{
	return (nb%2);
}

void main()
{
	int a;
	printf("Enter an integer: ");
	scanf("%d", &a);

 
	if (isOdd(a))
		printf("%d is odd.\n",a);
	else
		printf("%d is even.\n", a);
 
	getch();
}


Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Changing strings