1. a.Write a single assignment statement that assigns to k the 1\'s digit of the
ID: 3629351 • Letter: 1
Question
1. a.Write a single assignment statement that assigns to k the 1's digit of the value of j. For example, if j has a value of 235, your assignment statement should end up assigning a value of 5 to k. (Hint: the right-hand side of the assignment statement should be an expression that uses the modulus operator (%)). Make sure that your statement works for an arbitrary value of j.b. Write a single assignment statement that assigns to k the 10s digit of the value of j. For example, if j has a value of 235, your assignment statement should end up assigning a value of 3 to k; if j has a value of 8, your statement should end up assigning a value of 0. (Hint: the right-hand side of the assignment statement should be an expression that uses two mathematical operators.) Make sure that your statement works for an arbitrary value of j.
Explanation / Answer
please rate - thanks
a) k=j%10;
b) k=j/10%10;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.