Can somone give me the codes for the following C program. not C ++ need C snytax
ID: 3761601 • Letter: C
Question
Can somone give me the codes for the following C program. not C ++ need C snytax. this is a function problem
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
//
// main.c
// Chegg
//
// Created by Ayush Khatri on 11/11/15.
// Copyright © 2015 Ayush Khatri. All rights reserved.
//
#include <stdio.h>
int even(int n){
return n % 2 == 0;
}
int main(){
int n;
scanf("%d",&n);
if(even(n) == 1)
printf("%d is even",n);
else
printf("%d is odd",n);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.