Answer:
I would pick A B and D to be my answer
Answer: You need a temporary variable to hold the value 3
Explanation:
So, aList[0] is 3 and aList[1] is 19, if it will be as it is you litteraly say to the compiler to change aList[0] to aList[1] at this moment aList[0] is 19 and aList[1] also is 19 and if you try to change aList[1] to aList[0] it will not change its value because they are the same.
You need temp variable to keep one of the values.
Answer:
There are 7 scores recorded. The dropped score is 75
Explanation:
The code snippet above prints through the document.write() function. the output prints the string serving as the argument, and makes use of variables (lgth) and expression also (scores [lgth -1]). what it does is. From the point where it sees +lgth+, it checks the value, which is 7. And when it sees scores [lgth-1] it evaluates it to 75. Hence, the string above is produced.
Answer:
#include <stdio.h>
#include <ctype.h>
void printHistogram(int counters[]) {
int largest = 0;
int row,i;
for (i = 0; i < 26; i++) {
if (counters[i] > largest) {
largest = counters[i];
}
}
for (row = largest; row > 0; row--) {
for (i = 0; i < 26; i++) {
if (counters[i] >= row) {
putchar(254);
}
else {
putchar(32);
}
putchar(32);
}
putchar('\n');
}
for (i = 0; i < 26; i++) {
putchar('a' + i);
putchar(32);
}
}
int main() {
int counters[26] = { 0 };
int i;
char c;
FILE* f;
fopen_s(&f, "story.txt", "r");
while (!feof(f)) {
c = tolower(fgetc(f));
if (c >= 'a' && c <= 'z') {
counters[c-'a']++;
}
}
for (i = 0; i < 26; i++) {
printf("%c was used %d times.\n", 'a'+i, counters[i]);
}
printf("\nHere is a histogram:\n");
printHistogram(counters);
}