Difference between for loop and while loop?



Difference between for loop and while loop?..

Answer / dev yadav

in for loop we should know initial &last condition.....but in while loop we only know the last condition....
ex. of for loop..for(i=0;i<=10;i++){
printf("%d",i);
}
ex. of while loop..while(i<=10){
printf("%d",i);
i++;
}

Is This Answer Correct ?    10 Yes 4 No

Post New Answer

More C Interview Questions

how can i get the output 54321 4321 321 21 1 in c programming........???? pls help......

10 Answers   Infosys,


What does the file stdio.h contain?

0 Answers  


Describe newline escape sequence with a sample program?

0 Answers  


write a program to delete an item from a particular location of an linear array?

1 Answers  


List the variables are used for writing doubly linked list program.

0 Answers   Infosys, Wipro,


a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above

0 Answers  


what is linkage error when it occurs in c program

3 Answers  


Do variables need to be initialized?

0 Answers  


Is c procedural or functional?

0 Answers  


What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file

0 Answers  


Determine the result of performing two successive block transfers into the same area of a frame buffer using the binary arith operations

0 Answers  


write a prgram of swapping with 2 valiables

6 Answers  


Categories