WHAT WILL BE THE OUTPUT OF THE FOLLOWING QUESTION
void main()
{
int x=4,y=3,z;
z=x-- -y;
printf("%d%d%d",x,y,z);
}
Answers were Sorted based on User's Feedback
Answer / shreyas
the answer is 3 3 1..........
while computing value of z ....x will be 4 .....but while
printing its value it has been decremented by 1 and hence x=3.
Is This Answer Correct ? | 42 Yes | 2 No |
Absolutely.. 3 3 1
No doubt in it.....all frnds who said it are right and their
explaination is also correct......
while Z is calculated X is 4...since it is post decrement....
Is This Answer Correct ? | 12 Yes | 3 No |
Answer / amrita mohanty
3,3,1
since it is a post increment operation,so x--=4 initially.
but after that the value of x becomes 3.
x-- - y = 4-3=1
therefore x=3,y=3,z=1
Is This Answer Correct ? | 9 Yes | 0 No |
Answer / anjana priyadharshini
THE OUTPUT IS: 3,3,1
THE PEOPLE WHO TOLD THIS ANSWER THEIR EXPLANATION IS CORRECT
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / medo
#include<stdio.h>
void main()
{ int x,y,z;
{
int x=4,y=3,z;
z=x---y;
printf("x=%d\ny=%d\nz=%d\n",x,y,z);
}
}
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / vishnu
initally x=4,y=3
z=x-- -y;
after doing x-y operation and that value wil be assigned to
z.there followed by x value wil be decreased by 1.
hence z=4-3 z=1
x=4-1 x=3
y=3
hence output will be
3,3,1
Is This Answer Correct ? | 2 Yes | 0 No |
How to create a program that lists countries capitals when country is entered? (Terribly sorry, I'm a complete novist to coding with C, am looking for inspiration and general tips on how to code and create this program.)
Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has already been declared, use a do...while loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j .
Write a C program to enter 10 integer numbers through one variable and count how many of them are even using while loop ?
Display this kind of output on screen. 1 0 1 1 0 1 3. Display this kind of output on screen. 1 1 0 1 0 1 4. Display this kind of output on screen. 1 1 0 1 0 1 5.Display this kind of output on screen. 1 2 3 4 5 6 7 8 9 10
Given that two int variables, total and amount, have been declared, write a loop that reads integers into amount and adds all the non-negative values into total. The loop terminates when a value less than 0 is read into amount. Don't forget to initialize total to 0. Instructor's notes: This problem requires either a while or a do-while loop.
how to convert decimal to hexadecimal without using arrays just loops
How to reverse a linked list without using array & -1? Thank you.
difference between c/c++ programing language? what is necessesity of c++ when existing c programing language?
what is run time error?
void main() { int i=7; printf("N= %*d",i,i); }
how to convert decimal to binary in c using while loop without using array
50 Answers Apple, Aptech, Arwen Tech, BCS, C2D Software, CEC,
Given that two int variables, total and amount , have been declared, write a sequence of statements that: initializes total to 0 reads three values into amount , one at a time. After each value is read in to amount , it is added to the value in total (that is, total is incremented by the value in amount ). Instructor's notes: If you use a loop, it must be a for loop. And if you use a loop control variable for counting, you must declare it.