Home
Mega Menu
FYBCS
_C
_HTML & CSS
SYBCS
_DS
_SCILAB
TYBCS
_JAVA
_PHP
Download Apk
Home
c
C Program - Write a function isEven, which accepts an integer as parameter and returns 1 if the number is even, and 0 otherwise. Use this function in main to accept n numbers and check if they are even or odd
C Program - Write a function isEven, which accepts an integer as parameter and returns 1 if the number is even, and 0 otherwise. Use this function in main to accept n numbers and check if they are even or odd
prozone
June 14, 2018
Program
#include<stdio.h>
int isEven(int);
main()
{
int n,no,c;
int i;
printf("how many no.:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&no);
c=isEven(no);
if(c==1)
printf("EVEN NO\n");
else
printf("ODD NO\n");
}
}
int isEven(int x)
{
if(x%2==0)
return 1;
else
return 0;
}
Output:
how many no.:3
5
ODD NO
7
ODD NO
6
EVEN NO
Post a Comment
0 Comments
Popular Posts
C Program - Write a program to accept a matrix A of size mXn and store its transpose in matrix B. Display matrix B. Write separate functions
June 15, 2018
C Program - Write a function, which accepts a character and integer n as parameter and displays the next n characters
June 14, 2018
C program - Write a menu driven program to perform the following operations till the user selects Exit. Accept appropriate data for each option. Use standard library functions from math.h
June 10, 2018
Follow Us
Tags
Powered by Blogger
0 Comments