Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <fcntl.h>
  3. #include <limits.h>
  4. #include <unistd.h>
  5.  
  6. int main(int argc, char *argv[]) {
  7. int max1 = INT_MIN;
  8. int max2 = INT_MIN;
  9. for(int i = 1; i < argc; ++i) {
  10. int in = open(argv[i], O_RDONLY);
  11. char c[20];
  12. while(read(in, c, 20)) {
  13. int a;
  14. sscanf(c + 16, "%d", &a);
  15. printf("%d\n", a);
  16. if(a >= max1) {
  17. max2 = max1;
  18. max1 = a;
  19. } else if(a > max2) {
  20. max2 = a;
  21. }
  22. }
  23. }
  24. float ans = (float) max2 / 100;
  25. printf("%.2f\n", ans);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement