0% found this document useful (0 votes)
3 views9 pages

Algorithms

The document outlines 20 different programs, each with a specific algorithm for various tasks such as printing dictionaries, calculating simple interest, and determining voting eligibility. Each program includes a step-by-step algorithm starting from input to output. The programs cover basic arithmetic operations, user interactions, and conditional checks.

Uploaded by

aryan.z51700
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views9 pages

Algorithms

The document outlines 20 different programs, each with a specific algorithm for various tasks such as printing dictionaries, calculating simple interest, and determining voting eligibility. Each program includes a step-by-step algorithm starting from input to output. The programs cover basic arithmetic operations, user interactions, and conditional checks.

Uploaded by

aryan.z51700
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Program 1: Dictionary Print

Algorithm

1.​ Start​

2.​ Create a dictionary with key–value pairs​

3.​ Print the dictionary​

4.​ End​

Program 2: Print Variables

Algorithm

1.​ Start​

2.​ Assign number = 100​

3.​ Assign height = 157​

4.​ Assign name = "Aniket"​

5.​ Print number, height, and name​

6.​ End​

Program 3: Simple Interest

Algorithm

1.​ Start​

2.​ Input principal, rate, and time​

3.​ Calculate SI = (principal × rate × time) / 100​


4.​ Print SI​

5.​ End​

Program 4: Perimeter of Square

Algorithm

1.​ Start​

2.​ Input side length​

3.​ Calculate perimeter = 4 × side​

4.​ Print perimeter​

5.​ End​

Program 5: Cube of a Number

Algorithm

1.​ Start​

2.​ Input number (Num)​

3.​ Calculate cube = Num³​

4.​ Print cube​

5.​ End

Program 6: Multiplication Table

Algorithm
1.​ Start​

2.​ Input number (num)​

3.​ Print “Multiplication table for num”​

4.​ Repeat from i = 1 to 10:​

○​ Calculate product = num × i​

○​ Print num × i = product​

5.​ End​

Program 7: Greet User by Name

Algorithm

1.​ Start​

2.​ Input name​

3.​ Print greeting → “Hello, [name]! Nice to meet you.”​

4.​ End​

Program 8: Greet User with Class

Algorithm

1.​ Start​

2.​ Input name​

3.​ Input class​

4.​ Print → “Hello, [name]! Welcome to class [class].”​


5.​ End​

Program 9: Area of Square

Algorithm

1.​ Start​

2.​ Input length of side​

3.​ Calculate area = side × side​

4.​ Print area​

5.​ End​

Program 10: Area of Circle

Algorithm

1.​ Start​

2.​ Input radius​

3.​ Calculate area = (22/7) × radius²​

4.​ Print area​

5.​ End

Program 11: Miles to Kilometers

Algorithm

1.​ Start​
2.​ Input distance in miles​

3.​ Convert km = miles × 1.609 (correction: 1.609, though code has 1.069)​

4.​ Print km​

5.​ End​

Program 12: Height in cm → feet and inches

Algorithm

1.​ Start​

2.​ Input height in centimeters​

3.​ Convert inches = cm ÷ 2.54​

4.​ Convert feet = inches ÷ 12​

5.​ Print inches and feet​

6.​ End​

Program 13: Area & Perimeter of Rectangle

Algorithm

1.​ Start​

2.​ Input length and breadth​

3.​ Calculate area = length × breadth​

4.​ Calculate perimeter = 2 × (length + breadth)​

5.​ Print area and perimeter​


6.​ End​

Program 14: Remainder of Two Numbers

Algorithm

1.​ Start​

2.​ Input num1, num2​

3.​ Calculate remainder = num1 % num2​

4.​ Print remainder​

5.​ End​

Program 15: Check if Number = 500

Algorithm

1.​ Start​

2.​ Input number​

3.​ If number = 500 → print “You got a Five hundred”​

4.​ End

Program 16: Largest of Three Numbers


Algorithm
1.​ Start​

2.​ Input three numbers: num1, num2, num3​

3.​ Set largest = num1​

4.​ If num2 > largest, set largest = num2​

5.​ If num3 > largest, set largest = num3​

6.​ Print largest​

7.​ Stop

Program 17: Voting Eligibility


Algorithm

1.​ Start​

2.​ Input age​

3.​ If age > 18, print "Eligible to vote"​

4.​ Else, print "Not eligible to vote"​

5.​ Stop

Program 18: Even or Odd


Algorithm

1.​ Start​

2.​ Input number​

3.​ If number % 2 == 0, print "Even"​

4.​ Else, print "Odd"​

5.​ Stop

Program 19: Compare Two Numbers


Algorithm

1.​ Start​

2.​ Input number1, number2​

3.​ If number1 > number2, print "First is greater"​

4.​ Else if number1 < number2, print "First is smaller"​

5.​ Else, print "Both are equal"​

6.​ Stop

Program 20: Percentage & Grade


Algorithm
1.​ Start​

2.​ Input marks of three subjects: sub1, sub2, sub3​

3.​ Compute total = sub1 + sub2 + sub3​

4.​ Compute percentage = (total / 300) × 100​

5.​ If percentage >= 90, grade = "A"​

6.​ Else if percentage >= 80, grade = "B"​

7.​ Else if percentage >= 70, grade = "C"​

8.​ Else, grade = "D"​

9.​ Print percentage and grade​

10.​Stop

You might also like