Loop structure
1. What can be done by the loop structure?
Ans: A statement could be executed many
times.
2. How many parts
are there in the For-loop structure? Explain.
Ans: There are three parts in the
For-loop structure. They are
1. initialization part;
2. conditional part;
3. increment part;
3. For-loop structure define with figure (For-loop structure wK fv‡e KvR K‡i
Zv wP‡Îi mvnv‡h¨ eY©bv Ki|)
Ans: cÖ_‡g initialization
part execute Ki‡e Zvici conditional part execute Ki‡e|
hw` conditional part true nq
Z‡e For loop –
Gi Body -†Z XzK‡e
Ges Body execute Kivi
ci increment part –
G †h‡q KvR K‡i cybivq conditional part – G cÖ‡ek Ki‡e| conditional part false n‡j Dnvi Body execute nB‡e bv|
1. For loop e¨envi K‡i 5 †_‡K
20 ch©šZ we‡hvo msL¨v ¸wj wjL|
Ans:
#include<stdio.h>
#include<conio.h>
main(){
int k;
for(k = 5; k<= 20; k = k+2){
printf("%4d",k);
}
getch();
}

No comments:
Post a Comment