0% found this document useful (0 votes)
4 views4 pages

Algorithm Practice

The document provides algorithms and flowcharts for various basic programming tasks, including adding two numbers, finding the largest of two numbers, checking if a number is even or odd, and calculating the factorial of a number. It also includes practice questions for further application of these algorithms, such as finding the square and cube of a number, swapping two numbers, and calculating areas of geometric shapes. Each algorithm is presented in a step-by-step format to facilitate understanding and implementation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Algorithm Practice

The document provides algorithms and flowcharts for various basic programming tasks, including adding two numbers, finding the largest of two numbers, checking if a number is even or odd, and calculating the factorial of a number. It also includes practice questions for further application of these algorithms, such as finding the square and cube of a number, swapping two numbers, and calculating areas of geometric shapes. Each algorithm is presented in a step-by-step format to facilitate understanding and implementation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

📘 Algorithms and Flowchart for Practice

1. Algorithm and Flowchart to Add Two Numbers


Step 1: Start
Step 2: Input number A
Step 3: Input number B
Step 4: SUM = A + B
Step 5: Display SUM
Step 6: Stop

2. Algorithm to Find Largest of Two Numbers


Step 1:
Start
Step 2:
Input number A
Step 3:
Input number B
Step 4:
If A > B, then
Display A is largest
Else
Display B is largest
Step 5: Stop
3. Algorithm to Check Whether a Number
is Even or Odd
Step 1: Start
Step 2: Input number N
Step 3: If N mod 2 = 0, then
Display "N is Even"
Else
Display "N is Odd"
Step 4: Stop

4. Algorithm to Find Sum of First 10 Natural Numbers


Step 1: Start
Step 2: Set SUM = 0, I = 1
Step 3: Repeat while I ≤ 10
SUM = SUM + I
I = I + 1
Step 4: Display SUM
Step 5: Stop
5. Algorithm to Calculate Factorial of a Number
Step 1:
Start
Step 2:
Input number N
Step 3:
Set FACT = 1, I = 1
Step 4:
Repeat while I ≤ N
FACT = FACT * I
I = I + 1
Step 5: Display FACT
Step 6: Stop

6. Algorithm to Find the Smallest of Three Numbers


Step 1: Start
Step 2: Input A, B, C
Step 3: If A < B and A < C
Display A is smallest
Else if B < C
Display B is smallest
Else
Display C is smallest
Step 4: Stop

7. Algorithm to Calculate Simple Interest


Step 1: Start
Step 2: Input Principal (P), Rate (R), Time (T)
Step 3: SI = (P * R * T) / 100
Step 4: Display SI
Step 5: Stop
10 Practice Questions

1. Find Square of a Number


o Input a number and calculate its square.
2. Find Cube of a Number
o Input a number and calculate its cube.
3. Swap Two Numbers
o Input two numbers and swap their values using a temporary variable.
4. Calculate Area of a Rectangle
o Input length and breadth, then calculate and display area.
5. Calculate Area of a Circle
o Input radius and calculate area using formula πr².
6. Check Whether a Number is Positive, Negative or Zero
o Input a number and display whether it’s >0, <0, or 0.
7. Find Sum of Digits of a Number
o Input a number and calculate the sum of its digits.
8. Reverse a Number
o Input a number and display it in reverse order.
9. Print Multiplication Table of a Number
o Input a number N and print its multiplication table up to 10.
10. Check Whether a Year is a Leap Year or Not

 Input a year and check if it is divisible by 4 (with century year check).

You might also like