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 ?
#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;
}