Skip to content

luc057.c

Problem Statement

Write a program using pointers to find the smallest number in an array of 25 integers.

Metadata

Property Detail
Author Amit Dutta amitdutta4255@gmail.com
Date 08 Feb 2026
License MIT License (See the LICENSE file for details)

Actions

Raw View on GitHub

💡 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>

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;
}