View Code of Problem 72

#include<iomanip>
using namespace std;
int main()
{
	float m,n;
	cin>>m>>n;
	float sum=m;
	m=m/2;
	for(int i=0;i<n-1;i++)
	{
		sum+=m*2;
		m=m/2;
	}
	cout<<fixed<<setprecision(2)<<m<<" "<<sum<<endl;
}
/*
Main.cc: In function 'int main()':
Main.cc:6:2: error: 'cin' was not declared in this scope
  cin>>m>>n;
  ^
Main.cc:14:2: error: 'cout' was not declared in this scope
  cout<<fixed<<setprecision(2)<<m<<" "<<sum<<endl;
  ^
Main.cc:14:45: error: 'endl' was not declared in this scope
  cout<<fixed<<setprecision(2)<<m<<" "<<sum<<endl;
                                             ^
*/

Double click to view unformatted code.


Back to problem 72