72.9k views
3 votes
Write an expression whose value is the result of converting the int value 42 to a str (consisting of the digit 4 followed by the digit 2).

2 Answers

2 votes
to write in standard form

make the value in between (1 - 9.9) by placing a dot

= 4.2

count the number of times you moved the dot.

Left means to a - power
Right means to a + power

(Don't forget to put ×10, it is the most essential thing that allow you to move the decimal place)

= 4.2×10^1

To check answer:

Anything to power one is the value itself

10^1 = 10

So, 4.2 × 10 = 42
User Tasha
by
6.2k points
3 votes

Answer:

char numb[2];

numb[0] = 52;

numb[1] = 50;

Print as a string

printf("%s\\", numb)

Explanation:

A string is the same as a vector of char.

We have to find the ASCII values of '4' and '2'

'4' has an ASCII value of 52

'2' has an ASCII value of 50

Expression:

char numb[2];

numb[0] = 52;

numb[1] = 50;

Print as a string

printf("%s\\", numb)

User PhilHoy
by
6.1k points