//To find smallest element using pointer in an array
#include <stdio.h>
int main()
{
int arr[10],i,n;
printf("\n Enter 10 values :");
for(i=0;i<=9;i++)
{
scanf("%d",&arr[i]);
}
n=*arr;
for(i=0;i<=9;i++)
{
if(*(arr+i)<n)
n=*(arr+i);
}
printf("\n Smallest Element in Array :%d",n);
return 0;
}
Comments
Post a Comment