-->

Header Ads

WAP to find minimum and maximum element from given array.

C Program:


#include<stdio.h>

#include<conio.h>

void main()

{

const int index=5;

int num[index],max,min,a;

clrscr();

for(a=0;a<5;a++)

{

printf("\nenter no:");

scanf("%d",&num[a]);

}

max=num[0];

min=num[0];

for(a=1;a<5;a++)

{

if(max<num[a])

max=num[a];

if(min>num[a])

min=num[a];

}

printf("\n============");

printf("\n\nmax is:%d",max);

printf("\n\nmin is:%d",min);

getch();

}



Output of c program:

No comments

Powered by Blogger.