Do-while loop describe with figure. (Do - While -loop structure wK
fv‡e KvR K‡i Zv wP‡Îi mvnv‡h¨ eY©bv Ki|)
Ans:First initilizaton the execute part then without checking condition part enter the body of the Do while loop and execute the increment part. If conditional part is true its again enter the body of the do while loop otherwis e it goes out form body.(cÖ_‡g initialization
part execute Ki‡e Zvici ‡Kvb condition check QvovB Do - While -loop – Gi Body -†Z cÖ‡ek Ki‡e Ges increment part execute nIqvi ci Body ‡_‡K †ei n‡q conditional part execute Ki‡e|
hw` conditional part true nq
Z‡e Do - While loop –
Gi Body -†Z cybivq
XzK‡e| wKš‘ conditional part false n‡j
Dnvi Body †Z wd‡i bv †h‡q Body Gi evwn‡i P‡j hv‡e| Ges Ab¨vb¨ statement execute Kiv ïiy Ki‡e|)
write a program using do while loop to write odd number from 5 to 20.(Do – While - loop e¨envi K‡i 5 †_‡K
20 ch©šZ we‡hvo msL¨v ¸wj wjL|)
Ans:
main(){
int number;
number= 1;
do {
printf(“%d”,number);
number= number+2;
} while (number<= 20)
getch();
}

No comments:
Post a Comment