Using a hand calculation determine the output for the follow
Using a hand calculation, determine the output for the following set of statements: int k, s[] = {3, 8, 15, 21, 30, 41}; for (k=0; k
Solution
The answer to the 1st question is :
This will throw error as for printing the values of the array {} is used hence it will throw error and the program is not compiled .
use the following printf statement to run the code successfully
printf(\"%d%d\ \",s[k],s[k+1]);
After using this printf the progam works as follows:
k=0
s[k]=3
s[k+1]=8
output=38
k=2
s[k]=15
s[k+1]=21
output=1521
k=4
s[k]=30
s[k+1]=41
output=3041
now k = 6 hence will come out of loop as k<=5 is false now the condition given in loop
![Using a hand calculation, determine the output for the following set of statements: int k, s[] = {3, 8, 15, 21, 30, 41}; for (k=0; kSolutionThe answer to the 1 Using a hand calculation, determine the output for the following set of statements: int k, s[] = {3, 8, 15, 21, 30, 41}; for (k=0; kSolutionThe answer to the 1](/WebImages/28/using-a-hand-calculation-determine-the-output-for-the-follow-1076895-1761564955-0.webp)