Showing posts with label computers. Show all posts
Showing posts with label computers. Show all posts

Friday, September 21, 2018

Can variables be used in low level languages

Earlier machine language or assembly language was used for writing programs.In such languages,if you need to store data,then the exact storage location inside the memory of the computer has to be assigned.This storage location refers to a specific memory address,which is represented in terms of hexadecimal numbers such as 006FF,112ED.
If you have to store 100 different values,then you have to remember the address of 100 different memoryblocations where the values are stored.This becomes tedious and to avoid this high-level languages are used.
High level languages allow you to use symbolic names known as variables,to refer to the memory location where a particular value is to be stored.

Hierarchy from machine language to high level language



A Diagram depicting the working of a programming language in a computer, meaning after we write code on a computer in a programming language following happens inside computer.





Hardware
|
\/
Machine Language
|
\/
Assembly Language
|
\/
High Level  Language
|
\/
Fortran,C,Pascal



Hierarchy from machine language to high level language



Machine Language:
They send instructions in the form of 0's and 1's which only the machine can understand.

Assembly language:
It contains symbolic machine language instructions.These are called mnemonics.It is little bit english.

High Level Language:
It contains a set of insructions which are simple english like,like spoken languages and are easy to understand and use.C,C++,Pascal,Basic are some exaplesof high level languages in which english words are used as instructions.

The figure shows how computer's hardware,machine language,assembly language and high level language are related to each other.

Flowchart symbols




Flowchart symbols
Flowchart symbols:what they mean?


Oval:Start or end of program.

Parallelogram: Input or output operation.

Rectangle:Decision making & branching.

Circle:Joining of 2 parts of program on same page.

Arrows:Flow lines.





Example of lamp:


Introduction-Algorithm

Algorithm is concise list of steps in english language in short sentences required in solving a problem.

Eg:

1. Check if a given number is even or odd

Algorithm :

1.Start
2. Accept the number.
3.Divide the number by 2
4.If the remainder of the division is zero,then the number is even.
5.Otherwise the number is odd.
6. End

2.Name the fruit.

Algorithm:

1. Start
2.Accept the character.
3.Print"enter alphabet a,b or c"
4. If a is entered,print apple.
5If b is entered ,print banana.
6. If c is entered,print cane.
7.End

3.Tell whether it is a leap year or not.

Algorithm:

1.Start.
2.Accept the year.
3.Print"enter any year.If n mod (%)4==0 or n%400==0) where n is the year.
4.Print "Leap year"
5.Otherwise,print "year is not a leap year.".
6.End