Ask Question
18 January, 14:18

Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards, then backwards. End each loop with a newline. Ex: If courseGrades

+3
Answers (1)
  1. 18 January, 17:17
    0
    The code is given below in C with appropriate comments at the sample example

    Explanation:

    #include

    int main (void) {

    const int NUM_VALS = 4;

    int courseGrades[NUM_VALS];

    int i = 0;

    / / taking examples of course grades

    courseGrades[0] = 7;

    courseGrades[1] = 9;

    courseGrades[2] = 11;

    courseGrades[3] = 10;

    for (int i = 0; i < NUM_VALS; i++)

    printf ("%i ", courseGrades[i]);

    printf ("/n");

    for (int i = NUM_VALS-1; i > = 0; i--)

    printf ("%i ", courseGrades[i]);

    printf ("/n");

    return 0;

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards, then ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers