Ask Question
15 November, 20:03

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

+5
Answers (1)
  1. 16 November, 00:00
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers