C program to find smallest number
#include<stdio.h>
#include<conio.h>
void main()
{
int n, num[100], i, min;
printf("\n Enter a number:");
scanf("%d",&n);
printf("\n Enter %d numbers:",n);
for(i=0;i<n;i++)
{
scanf("%d",&num[i]);
}
min=num[0];
for(i=0;i<n;i++)
{
if(num[i]<min)
{
min=num[i];
}
}
printf("\n smallest number=%d",min);
getch();
}
Output
In this program, users have to give how many numbers that is store in variable n and have to give total numbers.


0 Comments
Please do not enter any spam link on comment box