Evaluate the following C++ expressions where x, y, z are integers and m, n are floating point numbers. The value of x = 5, y = 4 and m = 2.5.
Answers
Answered by
2
I hope its the right answer only found 1 matching result
Evaluate the following C++ expressions where x, y, z are integers and m, n are floating point numbers. The value of x = 5, y = 4 and m = 2.5; ← Prev QuestionNext Question → 0 votes 1.4k views asked Jan 9 in Introduction to C++ by Padma01 (52.9k points) closed Jan 21 by Padma01 Evaluate the following C++ expressions where x, y, z are integers and m, n are floating point numbers. The value of x = 5, y = 4 and m = 2.5; 1. n = x + y / x; 2. z = m * x + y; 3. z = (x++) * m + x; introduction to c++ class-11 Share It On 1 Answer +1 vote answered Jan 9 by Chanda01 (57.6k points) selected Jan 21 by Padma01 1. n = x + y / x; = 5 + 4/5 = 5 + 0 (both x and y are int type. Therefore only integer part of quotient is considered) = 5 2. z = m * x + y; = 2.5 * 5 + 4 (m is float type, so x value is promoted to float [implicit conversion]) = 12.5 + 4 ‘ = 16 (2 is int type. So ‘.2’ , the fractional part is discarded) 3. z = (x++) * m + x; = 5*2.5 + x = 12.5 + 5 = 18 (z is int type, therefore the fractional part is removed, x is incremented after the addition) ← Prev QuestionNext Question → Related questions 0 votes 1 answer Which of the character is used as suffix to indicate a floating point value? asked Jan 8 in Introduction to C++ by Padma01 (52.9k points) introduction to c++ class-11 0 votes 1 answer Evaluate x + = x + + + x; Let x = 5; asked Jan 8 in Introduction to C++ by Padma01 (52.9k points) introduction to c++ class-11 0 votes 1 answer Assume n = 10; what will be result of n>>2;? asked Jan 8 in Introduction to C++ by Padma01 (52.9k points) introduction to c++ class-11 0 votes 1 answer If a = 17, b = 24, what is the result of the following? asked Jan 9 in Introduction to C++ by Padma01 (52.9k points) introduction to c++ class-11 0 votes 1 answer Write the C++ program to calculate Net salary. Program to Calculate Net Salary asked Jan 9 in Introduction to C++ by Padma01 (52.9k points) introduction to c++ class-11 Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask que
Answered by
0
1. n = x + y / x;
= 5 + 4/5
= 5 + 0 (both x and y are int type. Therefore only integer part of quotient is considered)
=5
2. z = m * x + y;
= 2.5 * 5 + 4 (m is float type, so x value is promoted to float [implicit conversion])
= 12.5 + 4 ‘
= 16 (2 is int type. So ‘.2’, the fractional part is discarded)
3. z = (x++) * m + x;
= 5*2.5 + x
= 12.5 + 5
= 18 (z is int type, therefore the fractional part is removed, x is incremented after the addition)
Similar questions
Social Sciences,
26 days ago
Computer Science,
26 days ago
Computer Science,
26 days ago
History,
1 month ago
History,
1 month ago
English,
9 months ago
Math,
9 months ago