Answer:
The program of the given expressions can be given as
Program:
#include <iostream>
using namespace std;
int main() //define main function.
{
float a,b,c,d,e,f,g,h; //define variable for hold values.
a=13 / 4;
cout<<"a:"<<a<<endl; //print value.
b= 2 + 12 / 4;
cout<<"b:"<<b<<endl; //print value.
c=21 % 5;
cout<<"c:"<<c<<endl; //print value.
d=3 - 5 % 7;
cout<<"d:"<<d<<endl; //print value.
e=17.0 / 4;
cout<<"e:"<<e<<endl; //print value.
f=8 - 5 * 2.0;
cout<<"f:"<<f<<endl; //print value.
g=4 + 5 % 2 - 3;
cout<<"g:"<<g<<endl; //print value.
h=15.0 + 3.0 / 2.0;
cout<<"h:"<<h<<endl; //print value.
return 0;
}
output:
a=3.
b=5.
c=1.
d=-2.
e=4.25.
f=-2.
g=2.
h=16.5.
Explanation:
In the above expression, all the options follow the bodmos rules. All the expression explanation can be given as:
In option(a) we divide the value.It gives the quotient.
In option(b) we first divide the value and then addition.
In option(c) we Modulus the value. It gives the remainder.
In option(d) we first Modulus the value and then Subtract It.
In option(e) we divide the value.It gives the quotient.
In option(f) we first multiply the value and then Subtract It.
In option(g) we first Modulus the value, second addition than subtraction.
In option(h) we first divide the value and then addition.