デイリーコーディング


1日目(2020年10月13日)
Codesignal百年祭.CPP
int centuryFromYear(int year) {

    if(year<=0)
       std::cout << "Enter valid year";

    else if (year <= 100)
        return 1;

    else if (year % 100 == 0)
        return year/ 100 ;
    else
        return year/ 100 + 1 ;
        return 0;
}

GeeksforgeeksスモファレレイズCPP
//User function template for C++
class Solution{
public:
    // function to return sum of elements
    // in an array of size n
    int sum(int arr[], int n) {
        // code here
        int SUM=0;
        for(int i=0; i<n; i++)
        {
            SUM+=arr[i];
        }
        return SUM;
    }

};