We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#include<iostream>usingnamespacestd;intmain(){longarr[4];for(inti=0;i<5;i++){cin>>arr[i];}// Insertion sortfor(inti=1;i<5;i++){inttemp=arr[i];intj=i-1;while(j>=0&&arr[j]>temp){arr[j+1]=arr[j];j--;}arr[j+1]=temp;}// sum without smallest numberlongWithout_smallest=0;// for(inti=1;i<5;i++){Without_smallest=Without_smallest+arr[i];}//sum without biggest numberlongWithout_biggest=0;for(inti=0;i<4;i++){Without_biggest=Without_biggest+arr[i];}cout<<Without_biggest<<" "<<Without_smallest;return0;}
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →
C++ Solution