- The missing value: We have an array $T[N]$ containing all integers in the interval $0 \cdots N$, except one integer. We want to determine which integer is missing from $T$ using multiple approaches. Example: for the following array $T$ of size $N=6$, the missing valu...
- Sum of the first and the last digits of a number: Write a C program that asks the user to enter an integer number greater than 9, then calculates the sum of the first and the last digits of the number. Running example:Input a number greater than 9: -12Input a number greater than 9: 925Sum of the fir...
- ADT for a point: Provide an ADT specification for a point in a two dimensional space. By definition, to create such a point, you need to provide two coordinates. Supplement your ADT with adequately chosen query functions....
- ADT for a robot: We aim to define a \(\texttt{Robot}\) ADT moving in a two dimensional space with functions allowing to: Create a robot from a position \((x, y)\) and a direction (\(\texttt{North}\), \(\texttt{South}\), \(\texttt{East}\), \(\texttt{West}\)) that beco...
- ADT for a set of n elements: Write an ADT specification for a set of n elements. Operations include (create set, add an element to a set, delete an element from a set, check whether an element is in a set, union of 2 sets, intersection of 2 sets, cardinality of a set, complement...
- ADT for Boolean type: Provide an ADT specification for \(\texttt{Boolean}\) type. By definition, a Boolean is either \(\texttt{true}\) or \(\texttt{false}\). The negation (\(\texttt{Not}\)) of a Boolean is also a Boolean. The \(\texttt{and}\) and \(\texttt{or}\) between t...
- Array manipulation using functions: Write the function $\texttt{int READDIM()}$ that reads and returns a strictly positive integer $N$ less than 50; Write the function $\texttt{void READARRAY(int T[], int N)}$ that fills $N$ positive integers in the array $\texttt{T}$; Write the functi...
- Program output 13: Give the output on the screen of the following program (indicate a space using this symbol _): #include<stdio.h>double mystery(int T[], int i){ int k; for(k=0 ; k<i ; k++) T[k] -= T[i] - k; return T[k] + ...
- Program output 12: Give the output on the screen of the following program (indicate a space using this symbol _): #include<stdio.h>int main(){ int a = 7, b = 4, c; double x = 0.02, y = -0.05, z = 0.1 ; printf("#1# %d ##\n", (a + b) % 1234); ...
- Program output 11: Give the output on the screen of the following program #include <stdio.h> #define PRINT(format,x) printf(#x " = %"#format"\t",x)#define NL putchar('\n'); #define PRINT1(f,x) PRINT(f,x);NL#define PRINT2(f,x1,x2) PRINT(f,x1);PRINT1(f,x2)#define...