Finding minimum and maximum number in the given number
#include<stdio.h>
int main(){
int count;
int arr[count];
int i;
int j;
int k;
int min,max;
printf("how many numbers you want to compare\n=");
scanf("%d",&count);
for(k= 0;k < count;k++){
printf("enter the value of number %d ",k);
scanf("%d",&arr[k]);
}
min = arr[0];
for(i=0;i<count;i++){
if(arr[i] <min){
min=arr[i];}
}
max = arr[0];
for(j=0;j<count;j++){
if(arr[j] >max){
max =arr[j] ;
}
}
printf("min = %d and max = %d",min,max);
}
Comments
Post a Comment