Advertisement
mohas8

umil

Sep 28th, 2022
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     while (1)
  6.     {
  7.         int cases, i, count = 0;
  8.         float arr[100], lowest, j, time;
  9.  
  10.         scanf("%d", &cases);
  11.         for (i = 0; i < cases; i++)
  12.         {
  13.             scanf("%f", &arr[i]);
  14.         }
  15.         lowest = arr[0];
  16.  
  17.         for (i = 1; i < cases; i++)
  18.         {
  19.             if (lowest > arr[i])
  20.             {
  21.                 lowest = arr[i];
  22.             }
  23.         }
  24.         printf("%.2f\n", lowest);
  25.     }
  26.     return 0;
  27. }
  28.  
  29. /*int arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
  30.     int i, smallest;
  31.  
  32.     smallest = arr[0];
  33.  
  34.     for (i = 1; i < 10; i++)
  35.     {
  36.         if (smallest > arr[i])
  37.             smallest = arr[i];
  38.     }
  39.  
  40.     printf("Smallest element of arr is %d", smallest);*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement