Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

sum function in c++

// C++ program to demonstrate
// example of sum() function.
  
#include <bits/stdc++.h>
using namespace std;
  
int main()
{
  
    // Initializing valarray
    valarray<int> varr = { 15, 10, 30, 33, 40 };
  
    // Displaying sum of valarray
    cout << "The sum of valarray is = "
         << varr.sum() << endl;
  
    return 0;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #sum #function
ADD COMMENT
Topic
Name
9+1 =