fork(1) download
  1.  
  2. #include <stdio.h>
  3. #include <limits.h>
  4.  
  5. int main(void) {
  6. int nums[4]={100, 200, 300, 50}; //we declare an array
  7. int n = sizeof(nums)/sizeof(nums[0]); // we check the lenght of the array
  8. int min = INT_MAX; // we start that the min int is the maximum one
  9.  
  10. // walk the array
  11. for (int i=0;i<n;i++){
  12. // compare if num is smaller then int. this is why min is the max value.
  13. if (nums[i]<min){
  14. min=nums[i];
  15. }
  16.  
  17. }
  18.  
  19. printf("%d",min);
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 4288KB
stdin
Standard input is empty
stdout
50