Question Name:MIN MAX

#include <stdio.h>
int main()
{
int a,b[10],i,max=0,min=100;
  
  scanf("%d",&a);
  for(i=0;i<a;i++) 
  { 
    scanf("%d",&b[i]);
  } 
    for(i=0;i<a;i++) 
    { 
      if(min>b[i]) { min=b[i];} 
            if(max<b[i]) { max=b[i];} 
    } 
  printf("Minimum element in an array : %d\n",min);
  printf("Maximum element in an array : %d",max);
	return 0;
}
  • Problem Description
    Given a list of N integers, your task is to find out the miniumum and maximum. 

    Input Format: 

    No.of integers and the integers
  • Test Case 1
    Input (stdin)5
    2 3 1 6 7
    Expected OutputMinimum element in an array : 1
    Maximum element in an array : 7
  • Test Case 2
    Input (stdin)6
    11 2 10 6 5 1
    Expected OutputMinimum element in an array : 1
    Maximum element in an array : 11

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.