SHARE
TWEET

task 3( ds lab 3) 3rd sem

Adrita Jan 22nd, 2020 (edited) 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int n,i,sum=0,j;
  6.     cin>>n;
  7.     int arr[2*n];
  8.     for(i=0;i<2*n;i++)
  9.     {
  10.         cin>>arr[i];
  11.     }
  12.     sort(arr,arr+i);
  13.     for(j=0;j<i;j=j+2)
  14.         sum=sum+arr[j];
  15.     cout<<sum;
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top