#include <fstream> #include <iostream> using namespace std; int main() { ifstream df ("U1.txt"); ofstream rf ("U1rez.txt"); int a,n; df >> a >> n; int suma=0; for (int i = a; i <= n; i++) { suma=suma + i; } rf<<suma; df.close(); rf.close(); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter