Smallest number in array

C program to find smallest number in array :

code

#include<stdio.h>
#include<conio.h>
void main()
{
int small,arr[10],i,size;
clrscr();
printf(“How many number do you want to insert :”);
scanf(“%d”,&size);
printf(“Enter %d number from keyboard :\n”,size);
for(i=0;i<size;i++)
{
scanf(“%d”,&arr[i]);
}
small=arr[0];
for(i=0;i<size;i++)
{
if(small>arr[i])
{
small=arr[i];

}
}
printf(“\nSmall number in your list is %d”,small);
getch();
}

 


output

How many number do you want to insert :4

Enter 4 number from keyboard :

4

7

1

6

Small number in your list is 1

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s