Answer to Question #263739 in Programming & Computer Science for Crosxx

Question #263739

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;


1
Expert's answer
2021-11-09T23:38:58-0500
#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



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS