Unit1-Inroduction To Basic Coding
Unit1-Inroduction To Basic Coding
Unit1-Inroduction To Basic Coding
Basic of programming
English is the most popular and well-known Human Language. The English language has its own set
of grammar rules, which has to be followed to write in the English language correctly.
Likewise, any other Human Languages (German, Spanish, Russian, etc.) are made of several elements
like nouns, adjective, adverbs, propositions, and conjunctions, etc. So, just like English, Spanish or
other human languages, programming languages are also made of different elements.
Just like human languages, programming languages also follow grammar called syntax. There are
certain basic program code elements which are common for all the programming languages.
Programming Environment
Data Types
Variables
Keywords
Logical and Arithmetical Operators
If else conditions
Loops
Numbers, Characters and Arrays
Functions
Input and Output Operations
Algorithm:
What is an Algorithm? Algorithm Basics
The word Algorithm means ” A set of finite rules or instructions to be followed in
calculations or other problem-solving operations ” Or ” A procedure for solving a
mathematical problem in a finite number of steps that frequently involves recursive
operations”.
Therefore Algorithm refers to a sequence of finite steps to solve a particular problem.
Algorithms play a crucial role in various fields and have many applications. Some of the
key areas where algorithms are used include:
Computer Science: Algorithms form the basis of computer programming and are used to
solve problems ranging from simple sorting and searching to complex tasks such as
artificial intelligence and machine learning.
Compiler executes the code from top to bottom. The statements in the code are executed
according to the order in which they appear. However, Java provides statements that can be
used to control the flow of Java code. Such statements are called control flow statements. It is
one of the fundamental features of Java, which provides a smooth flow of program.
Decision-Making statements:
As the name suggests, decision-making statements decide which statement to execute and
when. Decision-making statements evaluate the Boolean expression and control the program
flow depending upon the result of the condition provided. There are two types of decision-
making statements in Java, i.e., If statement and switch statement.
1) If Statement:
In Java, the "if" statement is used to evaluate a condition. The control of the program is
diverted depending upon the specific condition. The condition of the If statement gives a
Boolean value, either true or false. In Java, there are four types of if-statements given below.
1. Simple if statement
2. if-else statement
3. if-else-if ladder
4. Nested if-statement
Flowchart In Programming
2. Find the largest among three different numbers entered by the user.
Flowchart to find the largest among three numbers.
What is compiler:?
A compiler is a special program that translates a programming language's source code into
machine code, bytecode or another
programming language. The source code is typically written in a high-level, human-readable
language such as Java or C++.
What is interpreter and compiler?
A Compiler takes a program as a whole. An Interpreter takes single lines of a code. Output.
The Compilers generate intermediate machine codes. The Interpreters never generate any
intermediate machine codes.
Types of Compiler
1. Cross Compilers
They produce an executable machine code for a platform but, this platform is not the one on
which the compiler is running.
2. Bootstrap Compilers
These compilers are written in a programming language that they have to compile.
3. Source to source/transcompiler
These compilers convert the source code of one programming language to the source code of
another programming language.
4. Decompiler
Basically, it is not a compiler. It is just the reverse of the compiler. It converts the machine code
into high-level language.
Features of a Compiler
Compilation speed.