Computer Science, asked by AsmodAliMondal, 1 year ago

Write a program to find out the maximum and minimum value of an array?

Answers

Answered by Aishwarya98
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..
Aishwarya98: mark me as brainliest.. if you are satisfied with my answer..
Similar questions