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

Saturday, 30 January 2016


Another Example 
  Write a program which can say which key you have pressed from the key board? [Suppose you can press any digit, character or functional key on the key board. After scanning that information the program has to say the category of key.]
wb‡Pi Program wU F7  w`‡q execute Kiv‡bv hvB‡e bv Ctrl+Fexecute Ki‡Z n‡e| Explain.
DËit F7 wb‡RB GKwU functional key hvi ASKEY value-Gi cª_g Ask 0. GB program wU F7 w`‡q  execute Kiv‡bvi mgq Qó jvB‡b getch() Gi gva¨‡g ASKEY value-Gi cª_g Ask 0 co‡j Dnv num variable-Gi wfZi Rgv ev store nq hvnv mßg jvB‡bi while condition-‡K K‡i ‡`q| d‡j, compiler while loop - Gi body - ‡Z XzK‡Z cv‡i b| GKvi‡b Program wU F7  w`‡q execute Kiv‡bv hvB‡e bv
      #include<stdio.h>
      #include<conio.h>
      void main(){
       int num,m;
       printf("\nEnter an inter vlaue =");
       num = getch();
       while(num != 0){
         printf("\nAskey = %d",num);
         num = getch();
       }
        

   }
Another example for if condition
Write a program which can calculate letter grate point of a student after getting marks from key board.
 #include<stdio.h>
 #include<conio.h>
 main(){
   int marks,i;
   printf("\nGive your number = ");
   scanf("%d",&marks);
   if(marks<0 || marks >100){
     printf("It is error number");
   }
   if(marks >= 0  && marks < 33){
     printf("The letter grade is = F");
   }
   if(marks >= 33  && marks < 40){
     printf("The letter grade is = D");
   }
   if(marks >= 40  && marks < 50){
     printf("The letter grade is = C");
   }
   if(marks >= 50  && marks < 60){
     printf("The letter grade is = B");
   }
   if(marks >= 60  && marks < 70){
     printf("The letter grade is = A-");
   }
   if(marks >= 70  && marks < 80){
     printf("The letter grade is = A");
   }
   if(marks >= 80  && marks <= 100){
     printf("The letter grade is = A+");
   }
   getch();

 }

Thursday, 28 January 2016

Another example of if condition for odd and even number

  Write a program which can read an integer value from key board and test weather it is odd or even.
      #include<stdio.h>
      #include<conio.h>
      void main(){
       int num,m;
       printf("\nEnter an inter vlaue =");
       scanf("%d",&num);
       m = num%2;
       if(m == 0)
        {
          printf("\n%d is Even");
        }
       else
        {
          printf("\n%d is Odd");
        }
          getch()

       }

Monday, 25 January 2016

  
Another example of if condition 
Suppose if any one get 33 or greater than that then it will be treated as pass marks otherwise fail. Now, write a program that will get a number from key board and store it to a variable then justify that mark for fail or pass.
    #include<stdio.h>
    #include<conio.h>
    main(){
     int number;
     printf("\nGive a value = ");
     scanf("%d",&number);
     if(india >= 33 && india <= 100){
       printf("\n%d is pass mark",number);
     }
     else
     {
       printf("\n%d is Fail Marik",number);
     }
      getch();    [it's use for hold character in computer memory] 
    

  }
Note: i am not use the getch() function to my older post please use the getch()function for see the out put of the program. other wise program run but dot show the out put in the screen.

Thursday, 21 January 2016


Another example of if condition

   Write a program whose input and output are as follows:
input
output
1
Saturday
2
Sunday
3
Monday
4
Tuesday
5
Wednesday
6
Thursday
7
Friday
Ans:
   #include<stdio.h>
   #include<conio.h>
   main(){
    int day_num;
    printf("\nInput the day number =" );
    scanf("%d",&day_num);
    if(day_num == 1){
     printf("\nIt is Saturday");
    }
    if(day_num == 2){
     printf("\nIt is Sunday");
    }
    if(day_num == 3){
     printf("\nIt is Monday");
    }
    if(day_num == 4){
     printf("\nIt is Tuesday");
    }
    if(day_num == 5){
     printf("\nIt is Wednesday");
    }
    if(day_num == 6){
     printf("\nIt is Thursday");
    }
    if(day_num == 7){
     printf("\nIt is Friday");
    }

 }

Wednesday, 20 January 2016

The original given number is   40. The original number is divisible by 7 and how much subtract form the original number?      (GKwU msL¨v 40 †`Iqv Av‡Q| Dnv n‡Z KZ we‡qvM Ki‡j, msL¨vwU 7 Øviv wefvR¨ nB‡e ?)

#include<stdio.h>
    #include<conio.h>
    main(){
      int total,remender;
      total = 40;
      remender = total/7;
      printf("\nThe anser is = %d",remender);
      printf("\nThe number is=%d" , remender); ['/n' is use for create new line]
   }

Tuesday, 19 January 2016

A simple programe 
  Multiplication of two number and take a number for input from those two number and find the other number of the multiplication.( `ywU msL¨vi ¸bdj Ges Dnv‡`i GKwU input wn‡m‡e wb‡q Aci msL¨vwU †ei Ki|)
    #include<stdio.h>
    #include<conio.h>
    main(){
      int total,one_num,sec_num;                 [declaration part of variable]
      printf("\nGive the total number = ");
      scanf("%d",&total);                              ['%d' use for decimal number]
      printf("\nGive First number of them = ");
      scanf("%d",&one_num);                      [ '&' use for store data in a variable]
      sec_num = total/one_num;
      printf("\nThe seconde number is =%d",sec_num);

    }

Monday, 18 January 2016


Second exemple of if ..else condition
17.     Write a program which can read an integer value from key board and test weather it is dividable by 5 or not ( 5 Øviv wefvR¨ wK bv Zv cix¶v Ki).
      void main(){
       int num,m;
       printf("\nEnter an inter vlaue =");
       scanf("%d",&num);
       m = num%5;
       if(m == 0)
        {
           printf("\n%d is dividable by 5",num);
        }
       else
        {
           printf("\n%d is not dividable by 5",num);
        }
      }


Sunday, 17 January 2016

I explain first program of  C using if condition and also explain if condition with example


 1.       Describe the structure of the simple if statement.
      Ans: The structure of the simple if statement is:
                   If( condition){
                      Statements1;
                        Statements2;   [ Body of the if condition]
                        … …  …  ….                   
                        … … ….  ….
                       Statements n
                   }
      Explanation: if – Gi  conditional part wU mZ¨ n‡j if – Gi  Body execute nB‡e Ab¨_vq if – Gi  Body execute nB‡e bv|

2.       Describe the structure of the compound if statement.
          Ans: The structure of the simple if statement is:
                   If( condition){
                      Statements1;
                        Statements2;           [true part]
                        … …  …  ….
                        … … ….  ….
                       Statements n
                   }
                   else
                   {
                      Statements1;
                        Statements2;          [false part]
                        … …  …  ….        
                        … … ….  ….
                       Statements n
                   }
      Explaination: if – Gi  conditional part wU mZ¨ n‡j if – Gi  True Body A_©vr if – Gi cÖ_g Ask execute nB‡e Ab¨_vq if – Gi  false Body A_©vr if – Gi wØZxq Ask execute nB‡e|
3.     Write a program which will print the sentence “It is rainy season” after getting ‘1’ from key board and will print “It is summer season” after getting ‘2’ from key board.
    #include<stdio.h>
    #include<conio.h>
    void main(){
      int dada;
      printf("\nEnter a value form key board = ");
      scanf("%d",&dada);
      if(dada == 1)
       {
         printf("\nIt is rainy season");
       }
      if(dada == 2)
       {
        printf("\nIt is summer season");
       }
    }

Saturday, 16 January 2016

Shot notes for C programming


Short notes on C Programming
1.       What the name of the symbol  “ = “ ?
      Ans: The name of the symbol of  “  = “ is assignment statement.

2.       What is the function of Assignment statement?
       Ans: The function of assignment statement ( i.e. “=”)  is to store the value of the right side variable to the left side variable.
       DËit Assignment statement -Gi KvR nj, Wvb cv‡k¦©i †Kvb variable Gi †h‡Kv‡bv  value evg cv‡k¦©i ‡Kvb variable -G Rgv Kiv|

3.       What do you mean by statement?
        Ans: a simple instruction or command to the computer which is used to do something by the computer is called statement.
         DËit ‡h †QvÆ †QvÆ ûKzg Øviv Computer-†K w`‡q KvR Kiv‡bv nq Zv‡K statement e‡j|

4.       `ywU statement wK wKfv‡e Avjv`v Kiv nq?
           Ans: We can separate two statements by a semicolon (;)

5.       Where a semicolon can not be used?
     Ans: if ev ‡h †Kvb loop – Gi c‡i semicolon(;) emv‡bv hv‡e bv|

6.       What do you mean by string constant?
     DËit ‡Kvb kã ev jvB‡bi `yB cv‡k¦© Wej †Kv‡Ukb _vK‡j †mwU †K string constant wn‡m‡e aiv nq|      
7.        What do you mean by variable?
       Ans: A memory space in the Hard disk where we can store a value.
8.        How can you give a name (bvg Ki‡Yi wbqg) of a variable?
           Ans:  We can give a name of a variable in 4 conditions.
(i) Only character, digit and underscore can be used.
                   (ii) Must start with a character.
                  (iii) Blank space is not allowed in the middle of a variable.  
                  (iv) You can use maximum 8 characters.

9.       What is the meaning of the statement “k  =  3;” ?
           Ans: k – Gi wfZi 3 Rgv n‡q hvI|

10.  What is the function of printf() function?
      DËit Bnvi gyj KvR nj gwbU‡i †Kvb Z_¨ †`Lv‡bv| Bnv wZb fv‡e †Kvb Z_¨ gwbU‡i †`Lv‡Z cv‡i| h_vt (i) String constant (ii) value of a variable (iii) String constant and value of a variable at the same time.
(i)                            String constant: printf() – Gi wfZi †Kvb kã e jvB‡bi `yB cv‡k¦© †Kvb double quotation _vK‡j †m wU hv Av‡Q wVK AweKj ZvB monitor-G show K‡i| wKšZz
(ii)                         Value of a variable: ‡Kvb k‡ãi `yB cv‡k¦© †Kvb double quotation bv _vK‡j †mwU variable wn‡m‡e a‡i Dnvi wfZ‡i †h value _‡K †mwU monitor-G show K‡i|
(iii)                       String constant + Value of a variable at the same time.
11.  What will be the output of the following statement?
(i)                            printf(“I live in Bangladesh”);  Output: I live in Bangladesh
(ii)                         suppose k = 3; printf(“%d”,k);  Output: 3
(iii)                       suppose p = 3; printf(“T = %d”,p); Output :  T = 3
         
12.  What is the function of scanf() function?
      DËit Bnvi gyj KvR nj key board ‡_‡K †Kvb value c‡o ev scan K‡i scanf() - Gi parameter Gi wfZi store Kiv |

13.   What is the meaning the following scanf() statement?scanf(“%d”,&abul) – Gi A_© nj †h value wU key board †_‡K †`Iqv n‡e †mwU Bnvi parameter variable (GLv‡b abul) Gi wfZi interger wn‡m‡e store Ki‡e|

(i)                            scanf(“%f”,&abul) – Gi A_© nj †h value wU key board †_‡K †`Iqv n‡e †mwU Bnvi parameter variable (GLv‡b abul) Gi wfZi float wn‡m‡e store Ki‡e|