Sunday, 21 February 2016

Example for array
write a program to store data in a array variable using for loop. (for loop e¨envi K‡i  array variable G data store Ki Ges †`LvI|) 
  #include<stdio.h>
 #include<conio.h>
 main(){
   int k,n,a[100];
   printf("\nHow many numbers you want to read = ?");
   scanf("%d",&n);
   for(k = 0; k<n; k++){
    printf("\nEnter a[%d] = ",k+1);
    scanf("%d",&a[k]);
   }
   for(k=0; k<n; k++){
    printf("%4d",a[k]);
   }
   getch();

  }

Sunday, 14 February 2016

ARRAY
1.       What do you mean by array?
      Ans: It is one kind of variable which can hold more than one same type of data and share a common name.

2.       What is the meaning of the following declaration or statements?
                        int dhaka[5];
               Ans: The variable dhaka  would  hold number of five integer type data.
DËit GLv‡b dhaka variable  5 wU  interger type of data store Ki‡Z cvi‡e| hvnv wP‡Îi mvnv‡h¨ †`Lv‡bv nj|
3.                         float kul[6];
               Ans: The variable kul  would  hold number of six float type data.
               DËit GLv‡b kul  variable  6 wU  float type of data store Ki‡Z cvi‡e|
4.        What is the meaning of the statement dhaka[2] = 45; ?
       Ans: dhaka is a variable of an array. It's index 2 store the number 45.
        DËit GLv‡b dhaka GKwU array variable. GB variable-Gi 2 bs index-G  45 store n‡e| hvnv wbb¥iy‡c †`Lv‡bv hvq|


Tuesday, 9 February 2016

 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);
                 numbernumber+2;
            } while (number<= 20)

    getch();
 }

Monday, 8 February 2016

Another exemple of while loop
Write 100 to 10 using while loop. (While loop e¨envi K‡i 100 †_‡K 1 ch©šZ we‡hvo msL¨v ¸wj  wbb¥ µgvbymv‡i wjL|)
 #include<stdio.h>
 #include<conio.h>
 main(){
   int k;
   k = 99;
   while(k >= 1){
    printf("%4d",k);
    k = k - 2;
   }
   getch();

 }

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();
 }

Monday, 1 February 2016

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();
 }