Write algorithm for the following problems.
1. To add two numbers.
2. To find out if a number is even or odd.
Answers
Answered by
146
Algorithms
The step by step description of cօde logic that helps us to write the cօde that is known as algorithm. It is written in simple and easy language.
Here's our algorithm to add two numbers.
Step 1: Take two number inputs or declare variables.
Step 2: Add both the two numbers using the addition operator.
Step 3: Assign the result.
Here's our algorithm to find out if a number is even or odd.
Step 1: Take any number input and store it in a variable [Suppose that here we have taken 'num' as a variable] or a declare variable.
Step 2: Check if num % 2 == 0 then it is a even number or else the number is odd.
Step 3: Assign the result.
Extra info
Here's some operators that are mainly used in programming:
Similar questions
English,
3 hours ago
Science,
5 hours ago
English,
5 hours ago
Political Science,
8 months ago
English,
8 months ago