Answer to Question #1172 in C++ for sam

Question #1172
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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS