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

Answer for Q16 and Q17 In plain English, what is E doing? Write what each functi

ID: 3808394 • Letter: A

Question

Answer for Q16 and Q17 In plain English, what is E doing? Write what each function call returns: a. E(2, 2); b. E(0, 100, 258); c. E(50, 1); d. E(1, E(1, 2)); Suppose we have the following array: double d[] = {3, 4, 5, -42, 2}; a. What type of elements is in d? b. What is size of d? c. What is d[0]? d. What is d[3]? e. What is d[5]? f. int x = 16; What is d[x % (size of d)]? What is d[x% (size of d)]? Implement the function f(x, y) = x^2 + y^2, where x and y are ints. The function cannot use any scanf or printf functions. It must return the correct output based on its input parameters. Implement the following functions.//Return the total number of characters in s that are digits (0-9) int totalDigits (char s[3][3]){...}//Return true if all elements in a (an array that has s elements) are equal to x; otherwise return false bool allEqualToX(int a[], int s, int x){...}//Print "even" if (x + y) is even, otherwise print "odd" void printEvenOrodd(int x, int y){...} Write a main function that calls each function in the previous with some sample input. What does each function call return for your sample input? What is a recursive function? Write a simple recursive function that can execute without any runtime errors. What is the scope of a variable? What are local variables, global variables, static variables, and external variables? What is a multi-module program? What things are typically put inside of a header file?

Explanation / Answer

16)

These are library files need to be included at first :-

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdbool.h>

int totalDigits(char s[3][3]){
int tot=0;
int i,j;
for(i=0;i<3;i++){
for(j=0;j<3;j++){
if(isdigit(s[i][j])){
tot++;
}
}
}
return tot;
}

bool allEqualToX(int a[],int s,int x){
int check=0;
int i=0;
for(i=0;i<s;i++){
if(a[i]!=x){
check++;
break;
}
}
if(check==0)
return true;
else
return false;
}

void printEvenOrOdd(int x,int y){
if((x+y)%2==0){
printf("Even ");
}
else
printf("Odd ");
}

17)MAIN FUNCTION:--

int main(void) {
   int a[10]={2,2,2,2,2,2,2,2,2,2};
   if(allEqualToX(a,10,2))
   printf("EQUAL ");
   else
   printf("NOT EQUAL ");
  
   printEvenOrOdd(2,3);
  
   char arr[3][3]={{'a','2','c'},{' ','5','p'},{'8','u','p'}};
   int x=totalDigits(arr);
   printf("The no of digits in the array = %d",x);
   return 0;
}