View Code of Problem 51

#include <iostream>
using namespace std;
int main(){
    int n ;
    cin >> n;
    
    int ans,k;
    
    for (int i = 0; i < n; i++)
    {
        /* code */
        for (int j = 0; j < n; j++)
        {
            /* code */
            cin>>k;
            if (i<=j)
            {
                /* code */
                ans=ans+k;
            }
            
        }
        
        
    }

    cout<< ans;
    
    
    return 0;
}

Double click to view unformatted code.


Back to problem 51