Ask Question

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

+2
Answers (1)
  1. 6 November, 05:59
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers