Thursday, October 30, 2014

Program :
                      Program is a set of instructions written in programming language to perform a specified task.

 Programming:
                  The process to give instructions to the computer is called programming .
 Programmer:
                        The person who is involved to  prepare a computer program is called programmer.

 System programmers:
                                                            The person who writes program to boot the computer to control the hardware components  etc are called system programmers.

 Application programmer:
                                                                  Appication programmer are used to design a application program to fulfill a specified task.

  Programming language:
                                                                        The language which is used to write programs for the computer is called programming language.

  Machine language:
                                The first language of computer was binary language, which is also known as machine language.
                                                                                            
  Assembly language:                                       
                                 Due to the complexities of machine language in the early 1950’s IBM company with contribution of computer scientists developed another language, which is known as assembly language.

  High level language: 
                                                          In the early 1960’s different languages were developed and used in the third generation of computers which are known as High level language.
  Compiler:

                         Compiler is a language translator that translates the program written in high level language to machine language at once.

  Interpreter:

                             Interpreter is a language translator that translates the program written in high level language to machine language statement by statement.

  Assembler:

                            Assembler is a language translator, which translates an assembly language program into its equivalent machine language program.  

  Fourth generation language:                                                            Fourth generation languages are closer to human languages than typical high level programming language.


  Advantages of machine language:

·                     Machine language is directly understood by the computer so the program written in machine language does not need to be converted.
·                     The program developed using machine  language becomes extremely fast since   no conversion is required.

      Disadvantage of machine language:

      
·                     Programming using machine language is difficult to write and remember.
·                     A machine language is machine dependent. Machine codes depend upon the architecture of the computer.
·                      It is time consuming and tedious task to modify the program written in machine language.

      Advantages of Assembly language:
                    
·                       As assembly language uses symbols and mnemonic codes it is easy  to understand write and modify program  in assembly language.
·                      It is easy to find out errors in the programs written in assembly language.
·                     The program written in assembly language executes faster because it is closer to the machine.

            
     Disadvantage of Assembly language:
·                     A assembly language  is also machine dependent language.The  program  written for one type of  computer has to be modified to use in another type of computer.
·                      Since assembly language is machine   dependent,the programmer must have   knowledge of hardware.
·                     The program written in assembly language is less efficient.The assembly  program takes more time to execute  than the machine codes program.

     Advantages of High level Language:
·                     As high level language are closer to English language, they are easy to  learn and use.
·                     High level language are machine independent.so,It is easy to write and  modify programs written in high  level   language.
·                     It is easy to do documentation of high level program.
·                     It is faster to write programs in the high level language.


     Disadvantage of High level language:
·                     High level programs takes more time to execute in computer.

·                      Programs written in high level language  must need language processors   to convert  into  machine  language.

Monday, August 11, 2014

god save us

Qbasic programming
1)  Wap to input any number and check whether the given number is divisible by 5 or not.

    REM
    CLS
    INPUT”Enter any number”; N
    IF N MOD 5=0 THEN
    PRINT”The given number is divisible by 5” 
    ELSE
    PRINT”The given number is not divisible by 5”
    END IF
    END


  2)  Wap to input any number and check whether the given number is divisible  by 3 and 7 or not.

   REM
   CLS
   INPUT”Enter any number”; N
   IF N MOD 3=0 AND N MOD 7=0 THEN
   PRINT”The given number is divisible by 3 and 7”
   ELSE
   PRINT”The given number is not divisible by 3 and 7”
   END IF
   END

3)   Wap to input any number and check whether the given number is positive negative or zero.

   REM
   CLS
   INPUT”Enter any number”; N
   IF N>O THEN
   PRINT”The given number is positive”
   ELSEIF N<0 THEN
   PRINT”The given number is negative”
   ELSE
   PRINT”The given number is zero”
   ENDIF
   END


4)   Wap to input any number and check whether the given number is odd or even
    REM
    CLS
    INPUT”Enter any number”; N
    IF N MOD 2=0 THEN
    PRINT”The given number is even”
   ELSE
   PRINT”The given number is odd”
   ENDIF
   END    

5) Input a mark in a subject of student and check if student is  pass or not.
REM
CLS
INPUT ”Enter mark of a student”;S
IF S>=40 THEN
PRINT”The student is pass”
ELSE
PRINT”The student is fail”
END IF
END


6)   Wap to input any 2 number and display the greater one.
     REM
    CLS
    INPUT”Enter first number”;A
    INPUT”Enter second number”;B
    IF A>B THEN
    PRINT A;”is greater”
    ELSE
    PRINT B;”is greater”
    END IF
    END

7)   Wap to input any 3 number and display the greatest one.
   REM
    CLS
    INPUT”Enter first number”;A
    INPUT”Enter second number”;B
    INPUT”Enter third number”;C
    IF A>B AND A>C THEN
    PRINT A;”is greatest”
    ELSEIF B>A AND B>C THEN
    PRINT B;”is greatest”
    ELSE
    PRINT C;”is greatest”
    END IF
    END

  8) Wap to display all natural numbers from 1 to 100.

  DO WHILE….LOOP                                                DO….LOOP WHILE 
REM                                                                REM
CLS                                                                  CLS
I = 1                                                                  I= 1
DO WHILE I < = 100                                        DO
PRINT I,                                                           PRINT I,
I = I+1                                                               I = I +1
LOOP                                                                LOOP WHILE I < =100
 END                                                                  END

DO UNTIL….LOOP                                               DO….LOOP UNTIL
REM                                                                   REM
CLS                                                                     CLS
I = 1                                                                                        
DO UNTIL 1 > 100                                              DO
PRINT I,                                                               PRINT I,
I = I+1                                                                   I= I+1
LOOP                                                                   LOOP UNTIL I >100
END                                                                      END

FOR….NEXT                                                         WHILE….WEND
REM                                                               REM
CLS                                                                 CLS
FOR A = 1 TO 100                                          I = 1
PRINT A,                                                        WHILE I < =100
NEXT A                                                         PRINT I,
END                                                                  I = I +1
                                                                         WEND
                                                                          END

9)   Wap to display 10, 20, 30….100.

DO WHILE….LOOP                              DO….LOOP WHILE
REM                                                                         REM
CLS                                                                          CLS
I = 10                                                                        I = 10
DO WHILE I < = 100                                             DO
PRINT I,                                                                  PRINT I,
I = I+10                                                                    I = I +10
LOOP                                                                     LOOP WHILE I < =100
 END                                                                     END

DO UNTIL….LOOP                        DO….LOOP UNTIL
REM                                                               REM
CLS                                                                CLS
I = 10                                                             I = 10
DO UNTIL 1 > 100                                     DO
PRINT I,                                                       PRINT I,
I = I+10                                                        I= I+10
LOOP                                                           LOOP UNTIL I >100
END                                                             END

FOR….NEXT                           WHILE….WEND
REM                                                            REM
CLS                                                             CLS
FOR A = 10 TO 100 STEP 1O                    I = 10
PRINT A,                                                    WHILE I < =100
NEXT A                                                      PRINT I,
END                                                            I = I +10
                                                                    WEND
                                                                    END



 10) Wap to display all even numbers from 50 to 1
DO WHILE….LOOP                               DO….LOOP WHILE
REM                                                                               REM
CLS                                                                                CLS
I = 50                                                                              I = 50
DO WHILE I < = 50                                                       DO
PRINT I,                                                                          PRINT I,
I = I - 2                                                                            I = I - 2
LOOP                                                                             LOOP WHILE I < =1
 END                                                                                END

DO UNTIL….LOOP                               DO….LOOP UNTIL
REM                                                                                REM
CLS                                                                                 CLS
I = 50                                                                                I = 50
DO UNTIL I < 1                                                               DO
PRINT I,                                                                          PRINT I,
I = I - 2                                                                             I= I - 2
LOOP                                                                              LOOP UNTIL I <1
END                                                                                 END




FOR….NEXT                                            WHILE….WEND
REM                                                                                         REM
CLS                                                                                          CLS
FOR A= 50 To 1 step-2                                                           I = 50
PRINT A,                                                                                 WHILE I <=1
NEXT A                                                                                    PRINT I,
END                                                                                          I = I - 2
                                                                                                  WEND
                                                                                                  END