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

how tally is useful?

2 Answers  


Write down the difference between c. Loop and goto statement d. (!0) and (!1) e. (1= =! 1) and (1!=1) f. NULL and !NULL

0 Answers  


I am using Qt 5.6 during compilation it stops and gives error about Qmake The process "C:QtQt5.6.35.6.3msvc2015_64inqmake.exe" crashed. Error while building/deploying project untitled1 (kit: Desktop Qt 5.6.3 MSVC2015 64bit) When executing step "qmake"

0 Answers  


Answering Yes or No in C++...using only stdio.h and conio.h..........help me please...? here's must be the output of the program: Screen A Exam No. items Score 1 20 20 2 35 35 Another Entry? [Y] or [N] : Screen B: Record No. Student's Name: 1 Fernando Torres 2 Chuck Norris Note: if you press Y, the program must repeat the procedure in screen A, then if N, the program must proceed to the screen B....Please Help me out............

1 Answers  


Declaration of Cube Guys please help me.. Is this a right way to declare cube.? If i Compile it. It Says: Cube undeclared what should i do? Please help \thanks in advanced #include<stdio.h> #include<math.h> #include<conio.h> main( ) { float x,y; while(x++<10.0) { printf("Enter Number:"); scanf("%d", &x); y = cube(x); printf("%f %f %f \n", x,pow(x,2),y); cube(x); } { float x; float y; y = x*x*x; } getch(); return (y); }

2 Answers  


what is macro in c? Difference between single linked list & double linked list what is fifo & lifo? what is stack & queue?

2 Answers   TCS,


How to upgrade LOOP environment, I just mean, how can i make loop statement editable ? I just try some program using loop statement and checking it in multiple compilers. Every compiler showing different output, what's the wrong ? is it a compiler based problem, or loop based problem, tell me why ? and what will be the debugging process, for this kind of problem ?

1 Answers  


How to convert hexadecimal to binary using c language..

1 Answers   Bajaj, GAIL, Satyam, Zenqa,


How to develop a program using C language to convert 8-bit binary values to decimals. TQ

1 Answers   Amazon,


what is syntax error?

3 Answers  


What is the out put of this programme? int a,b,c,d; printf("Enter Number!\n"); scanf("%d",&a); while(a=!0) { printf("Enter numbers/n"); scanf("%d%d%d",&b,&c,&d); a=a*b*c*d; } printf("thanks!"); getche(); Entering numbers are a=1,b=2,c=3,d=4 b=3,c=4,d=-5 b=3,c=4,d=0

5 Answers   TCS,


#include<>stdio.h> #include<>conio.h> { printf("hello"); void main() getch(); } what the out put of this program and why ......plz clear my answer

10 Answers   Wipro,


Categories