can i please get the solution of this C syntax program problem. i need C not c++
ID: 3767371 • Letter: C
Question
can i please get the solution of this C syntax program problem. i need C not c++ thanks
Program 1: Write a program that inputs a series of integers and passes them one at a time to function even, which uses the modulus operator to determine whether an integer is even. The function should take an integer argument and return true if the integer is even and false otherwise. Sample Output Enter an integer: 4 4 is an even integer Enter an integer: 3 3 is an odd integer Enter an integer: 2 2 is an even integer
Explanation / Answer
#include<stdio.h>
#include<conio.h>
int even(int n)
{
int r;
if(n%2==0)
{
r=1;
}
else
{
r=0;
}
return r;
}
void main()
{
int i,n,r;
for(i=0;i<3;i++)
{
printf(" Enter an Integer:");
scanf("%d",&n);
r=even(n);
if(r==1)
{
printf("%d is even
integer",n);
}
else
{
printf("%d is odd integer",n);
}
}
getch();
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.