Saturday, 6 February 2016

Descibe while-loop structure using fugure (While -loop structure wK fv‡e KvR K‡i Zv wP‡Îi mvnv‡h¨ eY©bv Ki|)

Ans: First initialization part execute then conditional part execute . if conditional part true so while loop entered the body of the loop and Body executethe increment part. after that loop again execute the condition part if the condition part is false the body not execute by the loop. (cÖ_‡g initialization part execute Ki‡e Zvici conditional part execute Ki‡e| hw` conditional part true nq Z‡e While 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|)
Write 5 to 20 odd number using while loop (While 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;
   k = 5;
   while(k<= 15){
    printf("%4d",k);
    k = k + 2;
   }
   getch();
 }

No comments:

Post a Comment