Convert to c++
Add .gitignore
Format main.cpp
Don't calculate the sum. It's unnecessary
Don't put a newline after 2

i%10 is 0. It's unexpected.