Thursday, 21 June 2012

write a c program to accept 10 number from user store these number in an array & find the smallest number from an array by using pointer


/*write a c program to accept 10 number from user store these number
in an array & find the smallest number from an array by using pointer*/
#include<stdio.h>
#include<conio.h>
void main()
{
int *a[10],*small,i,j;
clrscr();
printf("enter the element of array:\n");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
small=a[0];
for(i=1;i<10;i++)
{
if(*(a+i)<small)
small=*(a+i);
}
printf("\nsmall number is :%d",small);
getch();
}
/*enter the element of array:
7 8 5 6 32 4 5 2 5 6                                                          
                                                                               
small number is :2                                                            
  */

No comments: