146k views
2 votes
Write a program C statement to declare and initialize an array named afTest1 type float to store

5 test marks which are 90,30, 25, 45, 55. The program should print all the values that are stored
in the array.​

User Dbh
by
6.6k points

1 Answer

3 votes

Answer:

#include <stdio.h>

int main()

{

float afTest1[5] = {90, 30, 25, 45, 55};

for (int i = 0; i < 5; i++) {

printf("%f ", afTest1[i]);

}

return 0;

}

Step-by-step explanation:

Initialize the elements of the array as 90, 30, 25, 45, 55

Create a for loop that iterates through the array

Inside the loop, print each element using printf function

User Ankita Patel
by
7.9k points