+ 2
How to write c++ code to print the summation of series 2,4,8,16,....1024.
3 Respuestas
+ 15
int sum = 0;
for (int i = 2; i <= 1024; i *= 2)
{
sum += i;
}
std::cout << sum;
0
Using for loop,write a c++ program to find the sum of the first 10 numbers in the series: 2+4+8+16....