1. Give the output of the following code segment. #define SIZE 5 int nams [SIZE]
ID: 3559654 • Letter: 1
Question
1. Give the output of the following code segment.
#define SIZE 5
int nams [SIZE];
int i;
for (i=0; i < SIZE; i++)
nums[i] = i * 2;
for (i = SIZE -1; i >= 0; i--)
printf("%3d", nums[i]);
2. Give the output.
# define SIZE 5
int i;
double values [SIZE] = {4.3, 3.6};
values[3] = 2.5;
for (i=0; i < SIZE; i++)
printf("%4.1f", values[i]);
3. Give the output.
#define SIZE 10
int numbers[SIZE];
int x;
for (x=0; x<SIZE; x++)
numbers[x] = x;
for(x= SIZE; x>0; x--)
printf("%2d ", numbers[x]);
Explanation / Answer
1. output: 8 6 4 2 0
2. output: 4.3 3.6 0.0 2.5 0.0
3. output :
0
9
8
7
6
5
4
3
2
1
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.