Advertisement
_Nishat_tasnim

minimum & maximum

Mar 18th, 2021
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  
  7. long long int a[5], c=500000,sum=0,k=-5,d=0;
  8. for(int i=0;i<5;i++){
  9. scanf("%d",&a[i]);
  10. sum+=a[i];
  11. for(int m=0;m<5;m++){
  12. d=sum-a[m];
  13. if(c>d){
  14. c=d;
  15. d=0;
  16. }
  17. if(d>k){
  18. k=d;
  19. d=0;
  20. }
  21. }
  22. }
  23. printf("%d\n%d\n",c,k);
  24. return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement