c program to find smallest number using an array

c program to find smallest number using an array

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.


Post a Comment

0 Comments