#include <stdio.h>
// Function prototype
void displayAges(int ages[], int size);
int main() {
int ages[5]; // Array to hold ages
int i;
// Input ages
printf("Enter the age of 5 persons:\n");
for (i = 0; i < 5; i++) {
printf("Person %d: ", i + 1);
scanf("%d", &ages[i]);
}
// Call the function and pass the array
displayAges(ages, 5);
return 0;
}
// Function to display ages
void displayAges(int ages[], int size) {
printf("\nAges of persons are:\n");
for (int i = 0; i < size; i++) {
printf("Person %d: %d years\n", i + 1, ages[i]);
}
}