TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
How to Find Maximum & Minimum Element in the Array Program in C
Ashish Srivastava
Apr 23
2016
Code
1.4
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
#include<stdio.h>
# include<conio.h>
void
main()
{
int
a[100],i,n,max,min;
clrscr();
printf(
"How many elements in the array : "
);
scanf(
"%d"
,&n);
printf(
"Enter the elements : \n"
);
for
(i=0;i<=n-1;i++)
{
scanf(
"%d"
,&a[i]);
}
max = a[0];
min = a[0];
for
(i=1;i<=n-1;i++)
{
if
(max<a[i])
max = a[i];
if
(min>a[i])
min = a[i];
}
printf(
"maximum element in the array is :%d\n "
,max);
printf(
"minimum element in the array is : %d\n"
,min);
getch();
}
find maximum amp minimum element
array Program
C