In: Computer Science
|
|
|
|
|
In case of any queries,please comment. I would be very happy to
assist all your queries.Please give a Thumps up if you like the
answer.
1) Program
#include <iostream>
using namespace std;
int main()
{
int x = 5, y = 6, z = 4, w = 3.5;
cout<<((++y) * z) % x<<endl;
return 0;
}
Output
3
Here +++y gives 7
(++y)*z=7*4=28
28%3 =3, the answer
2) Program
#include <iostream>
using namespace std;
int main()
{
int x = 5, y = 6, z = 4, w = 3.5;
cout<<(x % y) % (--z) a)<<endl;
return 0;
}
Output
Error: Variable a is not declared
3) Program
#include <iostream>
using namespace std;
int main()
{
int x = 5, y = 6, z = 4, w = 3.5;
cout<<static_cast<int> ((--y) + x / z)<<endl;
return 0;
}
Output
6
4) Program
#include <iostream>
using namespace std;
int main()
{
int x = 5, y = 6, z = 4, w = 3.5;
cout<<static_cast<int> (w + static_cast<double>
(x / z + w))<<endl;
return 0;
}
Output
7