/*With an if-else statement detect if input number is odd or even with a function call*/
Solution Code:
=========
#include <stdio.h>
int odd(int i);
int main(void)
{
int i;
printf("Enter a decimal integer : ");
scanf("%d",&i);
if (odd(i))
printf("\n%d is Odd number",i);
else
printf("\n%d is Even number",i);
return 0;
}
int odd(int i)
{
return ( i % 2 );
}
No comments:
Post a Comment