c Built In Functions


Built In Functions
In these Functions rather than specifying the value inside a return
statement, we can specify a condition in the return statement.
If the given condition is TRUE 1 is returned. If FALSE then 0 is returned by
the Function.
Since 0 and 1 are INTEGERS, BUILT IN FUNCTIONS always return INTEGER
TYPE values.
All controls STRUCTURES can be Designed as Built in FUNCTIONS, because
when the parameter is ZERO, then the value returned is FALSE else the
returned Value is TRUE.
Program
#include<stdio.h>
void main()
{
int Even(int);
int a;
printf("\nEnter a Numeric Value : ");
scanf("%d", &a);
if(Even(a))
printf("\nThe Given Number %d is an Even Number.", a);
else
printf("\nThe Given Number %d is an Odd Number.", a);
}
int Even(int n)
{
return(n % 2 == 0);
}

No comments: