void main()
{
int i,j=2;
for(i=0;i<3;i++)
if(j=i)
cout<<"Lotus ";
else
cout<<"Rose ";
}
Its result is Rose Lotus Lotus.. How? Explain it?
Answer Posted / pasha nitw
i think u confused at step 5
if(j=i) is different from if(j==i)
where as in if(j=i)
first i value assigned to j value for entire loop
then it cheks the expression.
according to this
if(0)
if(1)
if(2)
.
.
.
.
Is This Answer Correct ? | 6 Yes | 2 No |
Post New Answer View All Answers
Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.
Performance Algorithm A performs 10n2 basic operations and algorithm B performs 300 lg n basic operations. For what value of n does algorithm B start to show its better performance?
Code for Small C++ Class to Transform Any Static Control into a Hyperlink Control?
Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).
write a program that creates a sequenced array of numbers starting with 1 and alternately add 1 and then 2 to create the text number in the series , as shown below. 1,33,4,6,7,9,............147,148,150 Then , using a binary search , searches the array 100 times using randomly generated targets in the range of 1 to 150
write a program using virtual function to find the transposing of a square matrix?
find level of following tree (state, parent) " J,D I,D H,C E,B F,B G,C B,A D,A C,A A,& K,E L,E L,F M,F N,G O,H P,I P,H Q,I R,J S,K U,P T,L
what mean void creat_object?in public class in this code class A{ public: int x; A(){ cout << endl<< "Constructor A";} ~A(){ cout << endl<< "Destructor A, x is\t"<< x;} }; void create_object(); void main() { A a; a.x=10; { A c; c.x=20; } create_object(); } void create_object() { A b; b.x=30; }
can you please write a program for deadlock that can detect deadlock and to prevent deadlock.
how to take time as input in the format (12:02:13) from user so that controls remains between these columns?
How can I Draw an ellipse in 3d space and color it by using graph3d?
write a program to perform generic sort in arrays?
A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect
Write a program that print in screen a tree with its height taken from user by entering number of 4 digits and find the odd numbers then calculate the sum of odd numbers so he get the height of tree?
solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)