0

Show the following series using loop: 1 1 2 2 4 7 11

Show the following series using loop: 1 1 2 2 4 7 11

18th Nov 2016, 9:22 AM
Shah Zaib
Shah Zaib - avatar
1 Réponse
+ 2
int arrLen; cout << "Enter lenght of series: "; cin >> arrLen; cout << 1 << " "; int temp = 1; for (int i = 0; i < arrLen; i++){ temp = i + temp; cout << temp << " "; }
18th Nov 2016, 6:40 PM
Mazdak Shojaie
Mazdak Shojaie - avatar