Write a program to find out the maximum and minimum value of an array?
Answers
Answered by
2
C program to find the maximum and minimum value of an array:
#include<stdio.h>
#include<conio.h>
int main()
{
int i,size,max,min; //array size
scanf("%d",&size);
int arr[size];
for(i=0;i<size;i++)
{
scanf("%d",&arr[i]);
}
max=arr[0];
min=arr[0];
for(i=0;i<size;i++)
{
if(arr[i]>max)
{
max=arr[i];
}
if(arr[i]<min)
{
min=arr[i];
}
}
printf("Maximum:%d",max);
printf("Minimum:%d",min);
return 0;
}
Aishwarya98:
hope this answer satisfies your question..
Similar questions
Chemistry,
7 months ago
Math,
7 months ago
Science,
7 months ago
Math,
1 year ago
India Languages,
1 year ago