Search
 
SCRIPT & CODE EXAMPLE
 

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;
}
Comment

Sum.cpp

#include<iostream>
using namespace std;
int main()
{
int x , y , sum;
cout<<"Enter the two numbers = 
";
cin>>x>>y;
sum = x + y;
cout<<"Sum = "<<sum;
return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp ::  
::  
::  
::  
Cpp ::  
:: c++ error 0xC0000005 
::  
Cpp ::  
C ::  
C :: terminal size in c 
:: buble sort c 
:: how to print something out to the console c 
::  
:: same project on different monitor in intellij mac 
::  
C ::  
C :: Successeur récurssive 
:: c 2d array dimensions 
:: unity set transform position code 
C ::  
::  
::  
::  
::  
C :: binary tree in c search 
C :: to run Blazor project using CLI 
C ::  
::  
::  
C :: best approach c menu terminal 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =