Pages

Friday, 8 February 2019

Program to find smallest number in an array of One Dimensional Array

Program to find smallest number in an array of one dimensional array
#include <stdio.h>
#define size 22
void main()
{
  int a[size],i,n,min;
  printf("\n Enter the size of an array : ");
  scanf("%d",&n);
  for(i = 0; i < n; i++)
   {
    scanf("%d",&a[i]);
   }
  printf("\n Array elements are  : ");
  for(i = 0; i < n; i++)
   {
    printf("\n Address : %p  --> Array  : a[%d]  --> Data : %d ",&a[i],i,a[i]);
   }
   min=a[0];
   for(i = 0; i < n; i++)
   {
    if(a[i]<min)
       min=a[i];
    }
    printf("\n smallest number in an array is %d",min);
}

output:

No comments:

Post a Comment

Programs in turboc3 : Files

File Handling in C File Handling concept in C language is used for store a data permanently in computer. Using this concept we can store our...