Посчитать сумму чисел, в промежутке от R до N включительно, которые в свою очередь задаются с клавиатуры.
Решение:
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include “stdafx.h” #include <iostream> using namespace std; int main() { int N, i, R, sum=0; cout<<“R=”; cin>>R; cout<<“N=”; cin>>N; for (i=R; i<=N; i++) { sum=sum+i; } cout<<sum<<endl; system(“pause”); return 0; } |

