Print smallest number using One Dimensional Array in C


This program is about checking and print the smallest number in a given array using For loop and if conditions.

Source Code

#include<stdio.h>
int main()
{
  int s=0,i,n,a[10],t=0,j;
  printf("ENTER LIMIT:");
  scanf("%d",&n);
  printf("ENTER VALUES:");
  for(i=0;i<n;i++)
  {
    scanf("%d",&a[i]);
  }
  t=a[0];
  for(i=1;i<n;i++)
  {
   if(t>a[i])
   {
     t=a[i];
   }
  }
  printf("THE LEAST VALUE IS:%d",t);
  return 0;
}
To download raw file Click Here

Output

ENTER LIMIT:5
ENTER VALUES:1
2
3
4
5
THE LEAST VALUE IS 1

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C


Learn All in Tamil © Designed & Developed By Tutor Joes