+ 2

How to write c++ code to print the summation of series 2,4,8,16,....1024.

16th Jul 2017, 7:34 PM
Waleed Yousif Taha Tai Allah
Waleed Yousif Taha Tai Allah - avatar
3 odpowiedzi
+ 15
int sum = 0; for (int i = 2; i <= 1024; i *= 2) { sum += i; } std::cout << sum;
16th Jul 2017, 7:42 PM
Hatsy Rei
Hatsy Rei - avatar
2nd Aug 2017, 1:28 PM
Jamiul Alam Rejon
Jamiul Alam Rejon - avatar
0
Using for loop,write a c++ program to find the sum of the first 10 numbers in the series: 2+4+8+16....
22nd Apr 2021, 7:13 AM
T.Anne