Write a program that displays the following table:
x y pow(x, y)
2.5 1.2 3.00281
5.0 2.4 47.5913
1.2 3.6 1.92776
2.4 5.0 79.6262
3.6 2.5 24.5899
#Beginner
In gcc c++ compiler using namespace std;
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
cout<<"x\t"<<"y\t"<<"pow(x,y)"<<endl;
cout<<2.5<<"\t"<<1.2<<"\t"<<pow(2.5,1.2)<<endl;
cout<<5.0<<"\t"<<2.4<<"\t"<<pow(5.0,2.4)<<endl;
cout<<1.2<<"\t"<<3.6<<"\t"<<pow(1.2,3.6)<<endl;
cout<<2.4<<"\t"<<5.0<<"\t"<<pow(2.4,5.0)<<endl;
cout<<3.6<<"\t"<<2.5<<"\t"<<pow(3.6,2.5)<<endl;
return 0;
}
Output
x y pow(x,y)
2.5 1.2 3.00281
5 2.4 47.5913
1.2 3.6 1.92776
2.4 5 79.6262
3.6 2.5 24.5899
[Program finished]
Comments
Post a Comment
Any doubt about programming or questions