#include <stdio.h> int main() { // Create a character array that displays the message "My Friends Ages Program" char message[] = "My Friends Ages Program"; // Create a second array that will store 4 integer values int ages[4]; // Use assignment statements to store the friend's ages ages[0] = 25; ages[1] = 27; ages[2] = 24; ages[3] = 26; // Use a puts() statement to display the message puts(message); // Use a for() statement to display each age stored in the array element for (int i = 0; i < 4; i++) { printf("Age of friend %d: %d\n", i + 1, ages[i]); } return 0; }
for
// Use a for() statement to display each age stored in the array element int i; for (i = 0; i < 4; i++)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)