CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

What is the output of the following program segment?
main ()
{
floata,b,c,X,Y,Z;
a=9;b=12;c=3;
X=ab/3+c21
Y=ab/(3+c)(21)
Z=a(b/(3+c)2)1
printf("X=%fnY=%fnZ=%Y",X,Y,Z);
}

A
X=10.000000,Y=7.000000,Z=4.000000
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
B
X=10.000000,Y=10.000000,Z=10.000000
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
X=3.000000,Y=0.500000,Z=7.333334
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
None of these
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is A X=10.000000,Y=7.000000,Z=4.000000

main()

{
float a,b,c,X,Y,Z;
a=9;b=12;c=3;
X=ab/3+c21

Y=ab/(3+c)(21)
Z=a(b/(3+c)2)1
printf("X=%fnY=%fnZ=%Y",X,Y,Z);

}

A float is a term is used in various programming languages to define a variable with a fractional value. Numbers created using a float variable declaration will have digits on both sides of a decimal point. This is in contrast to the integer data type, which houses an integer or whole number.

X=9-12/3+3*2-1=10

Y=9-12/ (3+3)*(2-1) =7

Z=9-(12/ (3+3)*2)-1=4

Output:-

X=10.000000 ,Y=7.000000, Z=4.000000.


flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Simple and Compound Interest
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon