Chapter - 9: Arrays

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


I
Sections
3
Exercises

A

B

C

D

E

F

G

H

I

J

K

L

1

2

3

4

#include<stdio.h>
#include<conio.h>
int main()
{
	int arr[25], i;
	int min = arr[0];
	int *ptr;

	for (i = 0; i < 25; i++)
	{
		printf("\nEnter element %d : ", i + 1);
		scanf("%d", (ptr + i));
	}

	ptr = arr;
	for (i = 0; i < 25; i++)
	{
		if (*(ptr + i) < min)
			min = *(ptr + i);
	}
	printf("\nmin : %d", min);

	_getch();
	return 0;
}

© 2020 Garbage Valuegarbage value logo