Assume that the variable num is properly declared as : int num = 7; Construct the equivalent expression using the arithmetic assignment operator to shorten it then evaluate the final value of num.
num = num % 3;
num = num * 4;
num = num + 13;
num = num – 2;
num = num / 3;
#include <iostream>
#include <string>
using namespace std;
int main() {
int num=7;
num %= 3 ;
num *= 4;
num += 13;
num -= 2;
num /= 3;
cout<<num<<"\n";
cin>>num;
return 0;
}
The final value of num=5
Comments
Leave a comment