as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
generate a correct c++ program to compute the sum of n numbers. output the code directly.
user
#include <iostream> 
  
using namespace std; 
  
int main() 
{ 
    int sum = 0, n; 
  
    cout << "enter the value of n: "; 
    cin >> n; 
  
    for (int i = 1; i <= n; i++) 
    { 
        sum += i; 
    } 
  
    cout << "sum = " << sum; 
  
    return 0; 
}
assistant