C program to find Smallest Element in Array in C Programming.

     

      #include <stdio.h>


int main()

{

    int i,number,smallest;

    int arr[100];

    printf("enter the value of array=> ");

    scanf("%d",&number);

              printf("enter the %d value array\n",number);

         for(i=0;i<number;i++)

         scanf("%d\n",&arr[i]);

         smallest=0;

        smallest=arr[0];

        for(i=0;i<number;i++){

        if(arr[i]<smallest)

        smallest=arr[i];

        }

    printf("the smallest number is %d",smallest);


    return 0;

}


No comments:

Post a Comment

Programming in C Language

  PROGRAM LIST TO BECOME PRO IN C    😍😍😍            PRACTICE SETS                                                        UNIT -1  👇   IN...