Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi everyone I\'m almost finish with this assignment and i need help with this qu

ID: 3586687 • Letter: H

Question

Hi everyone

I'm almost finish with this assignment and i need help with this question . I'll appreciate your help. Thanx U.Please respond in C language (not c++)

Write a function definition for a user-defined function called Compare_it. The function takes two integer arguments, solution and attempt. Your function should · if solution and attempt are the same display "It's a match" on the monitor retum the attempt if attempt is greater than solution: display"Too much"on-the-monitor- n the solution if attempt is less than solution -display "not enough"-on-the monitor a return the solution

Explanation / Answer

#include <stdio.h>

int Compare_it(int solution, int attempt) {
if(solution == attempt) {
printf("Its a match ");
return attempt;
} else if(attempt > solution) {
printf("Too much ");
return solution;
} else {
printf("not enough ");
return solution;
}
}
int main()
{
printf("%d ", Compare_it(5,5));
printf("%d ", Compare_it(5,6));
printf("%d ", Compare_it(6,5));
return 0;
}

Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote