Week2 Programming Assignment
Week2 Programming Assignment
4. Write a program to add, sub, divide and multiply any two numbers and display
the result
Here is the coding of a program to add, sub, divide and multiply any two
numbers and display the result
Display:
Compiler:
A compiler is a software tool that translates source code into machine code
in a separate step.
The compiler takes the entire source code as input, analyzes it, and
generates an object file or an executable file as output.
The generated object file or executable file can be executed multiple times
without the need for recompilation.
Compilers are typically used for languages such as C, C++, Java, and
Python.
Interpreter:
An interpreter is a software tool that translates source code into machine
code line by line as it is being executed. The interpreter reads a single line
of source code, translates it into machine code, executes it, and then
moves on to the next line of source code.
Interpreters do not generate an executable file, and the code needs to be
interpreted each time it is executed.
Interpreters are typically used for languages such as Python, Ruby, and
JavaScript.
Assembler:
An assembler is a software tool that translates assembly language into
machine code in a separate step.
Assembly language is a low-level programming language that is closer to
machine code than high-level programming languages.
The assembler takes the assembly code as input, analyzes it, and
generates an object file as output.
The generated object file needs to be linked with other object files to
produce an executable file.
Assemblers are typically used for programming languages such as
Assembly language.