luc057.c (975B)
1 /* 2 * Author : Amit Dutta <amitdutta4255@gmail.com> 3 * Date : 08 Feb 2026 4 * Repo : https://github.com/notamitgamer/bsc 5 * License : MIT License (See the LICENSE file for details) 6 */ 7 8 /* Write a program using pointers to find the smallest number in an array of 25 integers. 9 */ 10 11 /* Let Us C, Chap- 13 (Arrays), Qn No.: B(c) */ 12 13 /* This file is auto-generated by a bot. */ 14 /* This code is not compiled; it is for reference only. */ 15 16 17 #include <stdio.h> 18 #include <math.h> 19 #include <stdlib.h> 20 21 int main() 22 { 23 int arr[25], i, min; 24 int *ptr; 25 26 printf("Enter 25 integers:\n"); 27 for (i = 0; i < 25; i++) 28 { 29 scanf("%d", &arr[i]); 30 } 31 32 ptr = arr; // Point to start of array 33 min = *ptr; // Initialize min with first element 34 35 for (i = 1; i < 25; i++) 36 { 37 ptr++; // Move pointer to next element 38 if (*ptr < min) 39 { 40 min = *ptr; 41 } 42 } 43 44 printf("\nSmallest number is: %d\n", min); 45 46 return 0; 47 }