Difference between for loop and while loop?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What are static variables in c?

639


Write a program to print fibonacci series using recursion?

597


What tq means in chat?

601


Which is better pointer or array?

613


What is p in text message?

549






What are # preprocessor operator in c?

642


write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.

1991


Give differences between - new and malloc() , delete and free() ?

618


What is exit() function?

570


What are header files? What are their uses?

650


Is printf a keyword?

772


What are keywords in c with examples?

617


Explain the difference between null pointer and void pointer.

679


What is a loop?

564


What does return 1 means in c?

593