C Program to find smallest number with Output in a given array of elements.
Posted by Raj
C Program to find smallest number with Output in a given array of elements.
In this article ,I have written simple c program to find smallest number in a given array of elements.
Interview Question : Write a program to find the smallest and largest element in a given array in c?
Example:
/***
Program to find smallest Number
***/
#include<stdio.h>
#include<conio.h>
main()
{
int arr[50],n,j,s;
clrscr();
printf("Enter the size of array:");
scanf("%d",&n);
printf("Enter %d integers:",n);
for(j=0;j
scanf("%d",&arr[i]);
s==arr[0];
for(j=0;j
{
if(arr[i]
s=arr[i];
}
printf("Smallest number is %d",s);
getch();
}
Output:
Enter the size of array:3
34
35
60
Smallest number is: 34
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
C
.You can leave a response, or trackback from your own site.