C C++ program to find smallest minimum element in array

C C++ program to find smallest minimum element in array

C Language की विशेषताओं एवं शक्तियों को जानने के लिए देखें—Features and Powers of C

C Language में character set क्या होता है जानने के लिए देखें—Character set of C

C Language में Array और इसके विभिन्न प्रकारो के बारे में और अधिक जानने के लिए देखें— Arrays in C

C program to find smallest minimum element in array

#include<stdio.h>
int main()
{
    int num[5],i,small;
    printf("Enter elements of array: \n");
    for(i=0;i<5;i++)
    {
        scanf("%d",&num[i]);
    }
    small=num[0];
    for(i=0;i<5;i++)
    {
        if(num[i]<small)
        {
            small=num[i];
        }
    }
    printf("Smallest element = %d\n",small);
    return 0;
}

C++ program to find smallest minimum element in array

#include<iostream>
using namespace std;
int main()
{
    int num[5],i,small;
    cout<<"Enter elements of array: \n";
    for(i=0;i<5;i++)
    {
        cin>>num[i];
    }
    small=num[0];
    for(i=0;i<5;i++)
    {
        if(num[i]<small)
        {
            small=num[i];
        }
    }
    cout<<"smallst element = "<<small;
    return 0;
}

Output of C C++ program to find smallest minimum element in array

C C++ program to find smallest element in array

Other example programs for array in C C++

  1. Declaration and initialization of array
  2. Input-output in array
  3. Sum and average of array elements
  4. Largest Element in Array
  5. Reverse Elements of Array
  6. Merging two arrays
  7. Searching in array (Linear search)
  8. Sorting in array (Selection sort)
  9. Pointer to array
Share it to:

Published by

admin

I am a computer teacher, programmer and web developer