Hello friends!!!!!
How to find smallest number in the array
C LANGUAGE
10/2/20241 min read
#include <stdio.h>
int main() {
int a[5], small, i;
for(i = 0; i < 5; i++) {
printf("Enter a number: ");
scanf("%d", &a[i]);
}
small = a[0];
for(i = 1; i < 5; i++) {
if(a[i] < small) {
small = a[i];
}
}
printf("The smallest number is: %dn", small);
return 0;
}
Output :
Enter a number: 23
Enter a number: 34
Enter a number: 35
Enter a number: 56
Enter a number: 11
The smallest number is: 11
=== Code Execution Successful ===