. Write a program to find out smallest element of an array.



/*Program to calculate smallest number using array

Author:Priyanshu, Date: April 21,2021*/


#include<stdio.h>

#include<conio.h>


main()

  {

     int arr[10000],size,i,temp;

     clrscr();


     printf("Enter the size in between (1 to 10000) : ");

     scanf("%d",&size);


     for(i=0;i<size;++i)

{

   printf("Enter element of array: ");

   scanf("%d",&arr[i]);

}

     temp = arr[0];

     for(i=1;i<size;++i)

{

   if(temp > arr[i] )

      {

temp = arr[i];

      }

}

     printf("\n Smallest number  in an array: %d",temp);

     getch();

     return(0);

  }

   

Comments