Skip to main content\(\newcommand{\N}{\mathbb N}
\newcommand{\Z}{\mathbb Z}
\newcommand{\Q}{\mathbb Q}
\newcommand{\R}{\mathbb R}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 16.4 Practice: Conditional Compilation
Check Your Understanding Check Your Understanding
1.
What is the output of the following code?
#define DEBUG 1
#include <stdio.h>
int main(void)
{
int N, i, sum;
i = 1;
#if (DEBUG >=2)
printf("It's a beautiful day! ");
#elif (DEBUG >=1)
printf("It's sunny! ");
#elif (DEBUG >=0)
printf("Not too bad! ");
#else
printf("Huh...! ");
#endif
}
2.
Please correct the following loop, which is supposed to add up the numbers from 1 to n:
admin.....open in new window
When your program performs correctly you’ll be given a keyword to enter in Canvas.
3.
Please correct the following loop, which is supposed to add up the numbers from 1 to n:
admin.....open in new window
When your program performs correctly you’ll be given a keyword to enter in Canvas.