what is the difference between while and do while?

Answers were Sorted based on User's Feedback



what is the difference between while and do while? ..

Answer / jithender palle

In while case first execute the condition then ++/--,
In do while first ++/-- then condition execute

Is This Answer Correct ?    9 Yes 0 No

what is the difference between while and do while? ..

Answer / bhairavi

in while loop first condition is checked & then ++/-- is
done, in do while first whatever the condition given loop
execute atleast once ie.if i=0 the condition is while
(i<=0), i++ then also in do while loop i will increment
first & then it will check the condition so final value of
i will be 1

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More C Interview Questions

Study the code: void show() main() { show(); } void show (char *s) { printf("%sn",s); } What will happen if it is compiled & run on an ANSI C Compiler? A)It will compile & nothing will be printed when it is executed B)it will compile but not link C)the compiler will generate an error D)the compiler will generate a warning

4 Answers   Accenture,


Write a program which has the following seven functions. The functions should be: • main() this calls the other 6 functions • fget_long() a function which returns a long data type from a file • fget_short() a function which returns a short integer variable from a file • fget_float() a function which returns a floating point variable from a file • fprt_long() a function which prints its single, long argument into a file • fprt_short() a function which prints its single, short argument into a file • fprt_float() a function which prints its single, floating point argument into a file. You should use fscanf() to get the values of the variables from the input (the file) and fprintf() to print the values to the other file. Pay attention to using the correct format for each of the data types.

0 Answers  


the output will be #include<stdio.h> int main () { int i; i = 9/2; printf("%i",i); return 0; }

4 Answers   CMC, TCS,


What is the difference between local variable and global variable in c?

0 Answers  


difference between native and cross compilers

0 Answers  






What is getch?

0 Answers  


In a header file whether functions are declared or defined?

0 Answers   TISL,


can u write a program in C, which does not use = (eqaul)or any arithmatic assignment(like -=,+=,*= etc) operator to swap to number?

2 Answers  


main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } what is the output?

9 Answers   Ramco,


What are control structures? What are the different types?

0 Answers  


What are types of functions?

0 Answers  


Explain how does flowchart help in writing a program?

0 Answers  


Categories