Write a program in c++ and algorithm to find the sum of 'n' term of a series
1-1/2+1/4-1/8+1/16+............
#include <math.h>
#include "iostream"
using namespace std;
int main()
{
int i;
float s=0,k,h;
cout<<"Enter n : ";
cin>>i;
for(int t=0;t<i;t++){
s=s+1/(pow(2,t));
}
cout<<"Sum : "<<s<<endl;
system ("PAUSE");
}