Ask Question

Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTime = {800, 775, 790, 805, 808}, print:

800

775

790

Note: These activities may test code with different test values. This activity will perform two tests, the first with a 5-element array (int runTimes[5]), the second with a 4-element array (int runTimes[4]). See How to Use zyBooks.

+1
Answers (1)
  1. 24 August, 05:44
    0
    Following are the program in c language

    #include / / header file

    int main () / / main function

    {

    int runTimes[5]={800,775,790,805,808}; / / declared the array

    for (int k = 0; k < 3; k++) / / itearting the loop

    {

    printf ("/n%d", runTimes[k]); / / display array

    }

    return 0;

    }

    Output:

    800

    775

    790

    Explanation:

    Following are the description of program

    Declared a array "runTimes[5]" as the" int " type and store the five integer value in it. After that iterating the for loop from the 0 index to the less then 3 index. Inside the for loop we print the corresponding value that are stored in the particular index in the nextline.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTime = {800, ...” 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