Newbie C question

Written by  on April 17, 2018 

Hello, I'm trying to make a function to scan 5 numbers from the user and to print the minimum, but once I run it, it's printing the last inputted number:

{
int i, num, min,k;
for (i=0;i<5;i++){
scanf("%d",&num);
for (k=0;k<1;k++){
min=num;
}
if (num<min){
min=num;
}

}

printf("%d",min);
}

Category : Uncategorized

Leave a Reply

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