void main()
{
for(int i=0;i<5;i++);
printf("%d",i);
}
What is the output?..
Answers were Sorted based on User's Feedback
Answer / vera
012345
not
0
1
2
3
4
cz their is no printf("\n");
first time i=0 it print 0
scnd time i=1 it print 1
last time i=4 it print 4
but not 5 cz when i=5 :i is not <5
so it will not print 5
10x
| Is This Answer Correct ? | 4 Yes | 5 No |
Answer / sanjeevi
Guys remember things
1) we cant declare loop variable inside for
2) here i is local to for loop alone..
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / chuimaya
It gives an error coz we cannot declare a variable inside the for loop.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / ramveer
for the first loop i is 0 so 0 is printed
for 2nd time i++ i becomes 1 so 1 is printed
for 3rd time i becomes 2 so 2 gets printed
for 4th time i becomes 3 so it gets prited
for 5th time i becomes 4 so it gets printed
now for this time i has became 5 and this isn't in loop boudary as the condition is i<5 so its breaks out of loop.
so the ans is "0 1 2 3 4" .
| Is This Answer Correct ? | 9 Yes | 10 No |
Answer / erdem
Ofcourse
01234
(logic for start from 0 to 4 and no blank or tab)
| Is This Answer Correct ? | 1 Yes | 2 No |
write the value of x and y after execution of the statements: int x=19,y; y=x++ + ++x; x++; y++;
class test { int a; public: test(int b):a(b){} void show(){ cout<<a; } }; void main() { test t1; test t2(5); t1.show(); t2.show(); } }
Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do...while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total . Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total . Use no variables other than n , k , and total .
what is macro in c? Difference between single linked list & double linked list what is fifo & lifo? what is stack & queue?
What are the different types of errors in C and when they occur?
how to convert decimal to binary in c using while loop without using array
50 Answers Apple, Aptech, Arwen Tech, BCS, C2D Software, CEC,
wap for bubble sort
Write a program to accept two strings of Odd lengths. Then take all odd characters from one string and even characters from the other and concatenate and produce a string.
what are the techniques for reducing the fragility of a memory bug?
what is the error in the following code: main() { int i=400,j; j=(i*i)/i; }
UINT i,j; i = j = 0; i = ( i++ > ++j ) ? i++ : i--; explain pls....
void main() { int i=7; printf("N= %*d",i,i); }