Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Min-Max Sum
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- long double sk[11], sum=0, min=90000000001, max=-90000000001;
- for(int i=0;i<5;i++)
- {
- cin >> sk[i];
- }
- for(int i=0;i<5;i++)
- {
- sum=0;
- for(int a=0;a<5;a++)
- {
- if(i!=a)
- {
- sum+=sk[a];
- }
- }
- if(sum>max){max=sum;}
- if(sum<min){min=sum;}
- }
- cout << fixed << setprecision(0) << min << " " << max;
- return 0;
- }
Add Comment
Please, Sign In to add comment