int i;
i=2;
i++;
if(i=4)
{
printf(i=4);
}
else
{
printf(i=3);
}
output of the program ?
Answer Posted / 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 |
Post New Answer View All Answers
If you know then define #pragma?
What is an lvalue?
Are the variables argc and argv are local to main?
Explain how can I read and write comma-delimited text?
how do you programme Carrier Sense Multiple Access
What is a constant and types of constants in c?
What are the 4 types of organizational structures?
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
What is the scope of local variable in c?
What are the advantages and disadvantages of c language?
What does sizeof function do?
Is it valid to address one element beyond the end of an array?
What is the difference between void main and main in c?
Write the Program to reverse a string using pointers.
How can you draw circles in C?