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
Why c is a mother language?
What is the difference between int main and void main?
Write a c program to demonstrate character and string constants?
Explain what is the most efficient way to store flag values?
What is d'n in c?
Which is best linux os?
Is that possible to store 32768 in an int data type variable?
How can I ensure that integer arithmetic doesnt overflow?
what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values
please send me the code for multiplying sparse matrix using c
What are the types of data types and explain?
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above
4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.