luc059.c ​
Metadata ​
- Author — Amit Dutta
- Last updated — 08 Feb 2026
- License — MIT License (See the LICENSE file for details)
Problem Statement ​
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().
Source Code ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
c
#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;
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33