Write a C++ program to calculate and display the factors of the series that looks like this (1 , 2 , 4 , 8 , 16 , 32 , ........) up to the nth factor ?
1
Expert's answer
2010-12-20T16:39:58-0500
#include <iostream>#include <cmath> using namespace std; int main() { cout<<"Enter n: "; int n; cin>>n; for(int i=0;i<=n;++i){ cout<<pow(2, i)<<" "; } return 0; }
Comments
Leave a comment