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|
i am back after so long time. so I continue my blogge writing about c and c++ coding for beginer if  follow my blogge step by step it's easy to learning c and c++. Also asked questain about this topic every time i try to answer the question and solve the problem.