int i;
i=2;
i++;
if(i=4)
{
printf(i=4);
}
else
{
printf(i=3);
}
output of the program ?
Answers were Sorted based on User's Feedback
Answer / asit mahato
The conditional test if(i=4) is true for evrey non zero
value of i.As here i=3 here execute the if statement.But
printf can't print nothing because we have not mation the
proper syntax of printf.if we replace
printf(i=4)by printf("i=4")
it will give the following output:
i=4
Is This Answer Correct ? | 15 Yes | 1 No |
Answer / akbar shan
There Wont be any output for this program.It will show
error.Because 1:inside if "=" is used.2:"printf" cant print
the value
Is This Answer Correct ? | 13 Yes | 3 No |
Answer / stuti
This program will give error. Becoz the format of if
statement and printf statement- both are wrong.
In if, instead of if(i==4), if(i=4) is written and in
printf statement, there should be printf("i==4"); and printf
("i=3");
So it will not be compiled.
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / manishsoni
it show errors,bcoz
in c language,to print anyone we want to enclose that in " ".
so both the printf statement are wrong,so it is not show
proper result.
To show proper result we show that program and describe line
to line....
#include<stdio.h>
#include<conio.h>
int main()
{
int i;
i=2;
i++;
if(i=4)
{
printf("4");
}
else
{
printf("3");
}
getch();
}
In this prg i is declare as int type,after that 2 is store
into the i after i increased by not store so there is no
affect of the i's value.
at if statement
if(i=4)
here 4 is assigned into the i variable so
if statement is look like as;
if(4)which is treat is as ;
the if statement is thought that any non zero value is true
so if statement is true..
and execute first printf statement so the value is
printf("i=4");
so the final answer or result is:
i=4;
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ruchi
outout will be 4 in case code is printf("i=4");
printf("i=3");
else this program will show two error
Is This Answer Correct ? | 4 Yes | 4 No |
Explain the difference between getch() and getche() in c?
What is that continue statement??
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
how to use enum datatype?Please explain me?
How can I access an I o board directly?
How can I delete a file?
Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above
what r the cpu registers r ther?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
main() { int i; printf("%d",((i=1)*i-- - --i*(i=-3)*i++ + ++i)); } ans is 24 bt how?pls tell smbody............
How do you print an address?
Can we add pointers together?