void main()
{
for(int i=0;i<5;i++);
printf("%d",i);
}

What is the output?..

Answers were Sorted based on User's Feedback



void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?....

Answer / kumaran

declaring int i inside for loop is not available in
traditional 'c'

Is This Answer Correct ?    80 Yes 30 No

void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?....

Answer / mariaalex007

Answer is 5..........

Is This Answer Correct ?    114 Yes 77 No

void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?....

Answer / mahfooz

we can not declare loop condition variable in c..we can do
in c++.

Is This Answer Correct ?    38 Yes 20 No

void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?....

Answer / samir isakoski

why shoul have a cout if is c++

buth this is c (printf)

and why cannot daclare a int in the for ciclus

Is This Answer Correct ?    17 Yes 11 No

void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?....

Answer / divya

no output because the for loop is terminated with a semicolon which means the loop will terminate at once.

Is This Answer Correct ?    15 Yes 12 No

void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?....

Answer / radha raman

output=5

Is This Answer Correct ?    5 Yes 3 No

void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?....

Answer / shilpi

it will give 6 as a answer because condition is true inside and then it will increase its value by 1 and the terminate from the loop.

Is This Answer Correct ?    2 Yes 0 No

void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?....

Answer / ricky dobriyal

hi friend i am ricky dobriyal.
if this programe in c then this program produce error
expression syntex error.
if in c++ then it will produce o/p=5

Is This Answer Correct ?    10 Yes 9 No

void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?....

Answer / pramod

if it is in C it displays an error "indicating that "i"
cannot be declared in loop and i as undefined symbol"

if it the case of C++ it displays "5" because C++ supports
dynamic declaration and once declared anywhere in the
program(even in loops) can be used anytime in that program

Is This Answer Correct ?    2 Yes 2 No

void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?....

Answer / marius

if i have

$x=(11,22,33,44,55);
for($i=0;$i<5;$i++)
echo$x[$i]." ";

and we will print this:


11 22 33 44 55

$i=0 => 11
$i<5 => 44
$i++ => 55

ghigamarius@gmail.com

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C C++ Errors Interview Questions

what is the large sustained error signal that eventually cause the controller output to drive to its limit

1 Answers   TCS,


void main() { int i=5,y=3,z=2,ans; clrscr(); printf("%d",++i + --z + i++ + --i * ++y); i=5,y=3,z=2; ans=++i + --z + i++ + --i * ++y; printf("\n%d",ans); getch(); } Its output is 37 and 31.... Please explain me why its different How it works.....

2 Answers  


write a profram for selection sort whats the error in it?

2 Answers  


wap for bubble sort

3 Answers  


quoroum of computer languages?

0 Answers   Infosys,






how tally is useful?

2 Answers  


void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?..

32 Answers   College School Exams Tests, CTS, HCL, iGate, SmartData,


A sample program using data structure? what is file handling?

0 Answers   TCS,


Find the error (2.5*2=5) (a) X=y=z=0.5,2.0-5.75 (b) s=15;

3 Answers  


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(); } }

1 Answers  


write the value of x and y after execution of the statements: int x=19,y; y=x++ + ++x; x++; y++;

0 Answers  


how to convert decimal to hexadecimal without using arrays just loops

2 Answers  


Categories