C program to find smallest number in an array || User input || Arrays || C Programming
In this, we are going to print the smallest number among the array elements by taking input from user in C Programming Language.


 

#include <stdio.h>
int main()
{
    int a[30], i, num, smallest;
    printf("\nEnter no of elements :");
    scanf("%d", &num);
    for (i = 0; i < num; i++)
    {
        scanf("%d", &a[i]);
    }
    smallest = a[0];

    for (i = 0; i < num; i++)
    {
        if (a[i] < smallest)
        {
            smallest = a[i];
        }
    }
    printf("\nSmallest Element : %d", smallest);

    return (0);
}

//.......Coded By JAIDEEP JAMBHALE



#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post