Advertisement
LegoDrifter

Lab 5 - 1

Nov 24th, 2020
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5.  
  6. int main()
  7. {
  8. int n1,n2,n3,n;
  9. int d,cmp;
  10. scanf("%d",&n);
  11. for(int i=0;i<n;i++)
  12. {
  13. scanf("%d%d%d",&n1,&n2,&n3);
  14. d = (fabs(n1-n2) + fabs(n2-n3));
  15. if(i==0)
  16. {
  17. cmp = d;
  18. }
  19. if(i>0)
  20. {
  21. if(cmp>d)
  22. {
  23. cmp=d;
  24. }
  25. }
  26. }
  27. printf("%d",com_D);
  28. return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement