C++ program to divide two numbers and setting precision on answer

C++ program to divide two numbers and setting precision on answer .

Code

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{      int a,b;
       float c,d;
       int e;
       float f;
       float ans1;
       float ans2;
       //both integers
       cout<<"input an integer a=";
       cin>>a;
       cout<<"input another integer b=";
       cin>>b;
       cout<<"a/b="<<a/b<<endl;
       //both float
       cout<<"input an float c=";
       cin>>c;
       cout<<"input another float d=";
       cin>>d;
       ans1=c/d;
       cout<<c<<"/"<<d<<"=";
       cout<<setprecision(3)<<ans1<<endl;
       //one integer one float
       cout<<"input an integer e=";
       cin>>e;
       cout<<"input another float f=";
       cin>>f;
       ans2=e/f;
       cout<<e<<"/"<<f<<"=";
       cout<<setprecision(3)<<ans2<<endl;
       system("pause");
       return 0;
}

Output

Comments