Advertisement
#include<iostream>
using namespace std;
int main()
{
int a = 10, b =3;
//An arithmetic expression involving two int variables a and b
float result = a/b;
cout << "The result of dividing 10/3 is : " << div;
}
The value of dividing 10/3 is : 3
Advertisement
//C++ Example of type-cast operator
#include<iostream>
using namespace std;
int main()
{
int a = 10, b =3;
//Using the type-case operator to cast the result of an arithmetic expression
//involving two int variables, to float
float result = (float)a/b;
cout << "The result of dividing 10/3 is : " << result;
}
The result of dividing 10/3 is : 3.33333
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement