+ 4
Help c++
you need to find the sum of the squares of all integers from A to B (you can only use FOR)
7 Answers
+ 5
int n = 0, i = 0;
cin>>i; // enter A and B
cin>>n;
int sum = 0;
for(; i <= n; i++)
{
sum += i*i;
}
cout<< sum;
+ 10
[b.(b+1).(2b+1) - a. (a+1). (2a+1)]/6
//1 liner
//using basic maths
+ 3
if anything is not clear, just ask and i ll try to make it clear for ya
+ 2
#include<iostream>
struct Main
{
long long a,b,c,d;
Main()
{
std::cin>>a>>b;
c=a-(a-b)*(b<a);
d=a+(b-a)*(b>a);
std::cout<<d*-~d*-~(d<<1)-c*~-c*~-(c<<1);
}
}MAIN;
int main()
{
for(;;)
return 0;
}
+ 1
ty
+ 1
corrected