/*Slip20_1 : Write a function
isEven, whichaccepts an int as parameter abd return 1 if number is even
otherwise return 0 */
#include<stdio.h>
#include<conio.h>
int isEven(int);
void main()
{
clrscr();
int no,ans;
printf("\n
Enter no : ");
scanf("%d",&no);
ans=isEven(no);
if(ans==1)
printf("%d
is Even ",no);
else
printf("%d
is Odd ",no);
getch();
}
int isEven(int n)
{
if(n%2==0)
return
1;
else
return
0;
}
No comments:
Post a Comment