हिंदी
तमिलनाडु बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान कक्षा ११

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; z = m * x + y; - Computer Science

Advertisements
Advertisements

प्रश्न

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;

z = m * x + y;

योग

उत्तर

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)

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 9: Introduction to C++ - Data Types, Variables and Expressions - Evaluation - Section - C [पृष्ठ १५१]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 11 TN Board
अध्याय 9 Introduction to C++
Data Types, Variables and Expressions - Evaluation - Section - C | Q 3. (ii) | पृष्ठ १५१
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×