Skip to content

Commit

Permalink
Create 5. find max and minimum among a set of number array .c
Browse files Browse the repository at this point in the history
  • Loading branch information
shad-ct authored Oct 15, 2024
1 parent 27ce0cf commit 9c6bb27
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions LabRecord/5. find max and minimum among a set of number array .c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <stdio.h>

int main()
{
// find max and minimum among a set of number array
int num[100],i,len;
printf("Size of array : \n");
scanf("%d",&len);
printf("Enter your numbers : \n");


for(i=0;i<len;i++){
scanf("%d",&num[i]);
}

int max = num[0];
int min = num[1];

for(i=0;i<len;i++){
if(num[i]>max){
max = num[i];
}
if(num[i]<min){
min = num[i];
}
}

printf("Max is : %d and Min is : %d",max,min);


}

0 comments on commit 9c6bb27

Please sign in to comment.