luc059.c¶
Problem Statement
Write a program which initializes an integer array of 10 elements in main(), passes it to modify(), multiplies each element by 3, and prints the new array in main().
Metadata¶
| Property | Detail |
|---|---|
| Author | Amit Dutta amitdutta4255@gmail.com |
| Date | 08 Feb 2026 |
| License | MIT License (See the LICENSE file for details) |
Actions¶
💡 You can print or save this file by opening Raw and using your browser.
Source Code¶
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
void modify(int *, int);
int main()
{
int arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int i;
printf("Original Array:\n");
for (i = 0; i < 10; i++)
printf("%d ", arr[i]);
modify(arr, 10);
printf("\n\nModified Array (x3):\n");
for (i = 0; i < 10; i++)
printf("%d ", arr[i]);
printf("\n");
return 0;
}
void modify(int *a, int n)
{
int i;
for (i = 0; i < n; i++)
{
a[i] = a[i] * 3;
}
}