luc057.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 using pointers to find the smallest number in an array of 25 integers.
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>
int main()
{
int arr[25], i, min;
int *ptr;
printf("Enter 25 integers:\n");
for (i = 0; i < 25; i++)
{
scanf("%d", &arr[i]);
}
ptr = arr; // Point to start of array
min = *ptr; // Initialize min with first element
for (i = 1; i < 25; i++)
{
ptr++; // Move pointer to next element
if (*ptr < min)
{
min = *ptr;
}
}
printf("\nSmallest number is: %d\n", min);
return 0;
}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
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