Find Maximum and Minimum number from any number of input in c language | CTechnotips


#include<stdio.h>
#include<conio.h>
#define size 5

void main()
{
    int no[size],min=0,max=0,i;
    clrscr();
    for(i=0;i<size;i++)
    {
        printf("\n Please Enter %d number : - ",i+1);
        scanf("%d",&no[i]);
    }
    min=max=no[i];
    for(i=0;i<size;i++)
    {
        if(min>no[i])
        {
            min=no[i];
        }
        if(max<no[i])
        {
            max=no[i];
        }
    }
    printf("\n Minimum No is : - %d",min);
    printf("\n Maximum No is : - %d",max);
    getch();
}

0 comments:

Post a Comment