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

Algorithm

The document outlines a series of algorithms for various programming tasks, including temperature conversion, area calculation for different shapes, and statistical analysis. Each algorithm follows a structured approach, starting the program, taking user input, performing calculations, and displaying results. The tasks range from basic operations like even number listing to more complex functions like normal distribution and data frame manipulation.
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)
3 views8 pages

Algorithm

The document outlines a series of algorithms for various programming tasks, including temperature conversion, area calculation for different shapes, and statistical analysis. Each algorithm follows a structured approach, starting the program, taking user input, performing calculations, and displaying results. The tasks range from basic operations like even number listing to more complex functions like normal distribution and data frame manipulation.
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

1.

Temperature Conversion

Algorithm

1. Start the program.

2. Display menu: Fahrenheit→Celsius, Celsius→Fahrenheit, Exit.

3. Read the user’s choice.

4. If choice = 1, input Fahrenheit and convert to Celsius using formula.

5. If choice = 2, input Celsius and convert to Fahrenheit using formula.

6. Display the result.

7. Repeat until the user selects Exit.

8. Stop.

2. Area of Rectangle, Square, Circle, Triangle

Algorithm

1. Start the program.

2. Display menu for shapes.

3. Read the user’s choice.

4. Input required dimensions (length, width, radius, base, height).

5. Calculate area using respective formula.

6. Display the calculated area.

7. Stop.

3. List of Even Numbers

Algorithm

1. Start the program.

2. Input the range of numbers.

3. Use a loop to check each number.

4. If number mod 2 = 0, print it as even.

5. Continue until range ends.

6. Stop.

4. Square of Numbers in Sequence


Algorithm

1. Start the program.

2. Input the number of terms or range.

3. Generate the sequence of numbers.

4. Calculate square of each number.

5. Display the squares.

6. Stop.

5. cbind() and rbind()

Algorithm

1. Start the program.

2. Create two vectors or matrices.

3. Use cbind() to combine columns.

4. Use rbind() to combine rows.

5. Display the resulting matrix.

6. Stop.

6. String Manipulation

Algorithm

1. Start the program.

2. Input a string.

3. Apply string functions (length, paste, substring, etc.).

4. Display modified strings.

5. Stop.

7. List

Algorithm

1. Start the program.

2. Create a list containing different data types.

3. Access elements using indexing.

4. Display the list contents.


5. Stop.

8. Simple Calculator

Algorithm

1. Start the program.

2. Display operations: addition, subtraction, multiplication, division.

3. Input two numbers.

4. Input the operation choice.

5. Perform the selected calculation.

6. Display the result.

7. Stop.

9. Prime Number

Algorithm

1. Start the program.

2. Input a number.

3. Check divisibility from 2 to n/2.

4. If divisible, it is not prime.

5. Otherwise, it is prime.

6. Display the result.

7. Stop.

10. Vector

Algorithm

1. Start the program.

2. Create a vector with elements.

3. Perform vector operations (sum, mean, indexing).

4. Display results.

5. Stop.

11. Data Frames


Algorithm

1. Start the program.

2. Create vectors for different columns.

3. Combine them into a data frame.

4. Display structure and contents.

5. Stop.

12. Bar Chart

Algorithm

1. Start the program.

2. Input data values.

3. Create a vector for the data.

4. Use barplot() function.

5. Display the chart.

6. Stop.

13. Pie Chart

Algorithm

1. Start the program.

2. Input category values.

3. Store values in a vector.

4. Use pie() function.

5. Display the pie chart.

6. Stop.

14. Odd or Even

Algorithm

1. Start the program.

2. Input a number.

3. Check number mod 2.

4. If remainder = 0 → Even.
5. Else → Odd.

6. Display result.

7. Stop.

15. Factorial

Algorithm

1. Start the program.

2. Input a number.

3. Initialize factorial = 1.

4. Multiply numbers from 1 to n.

5. Display factorial value.

6. Stop.

16. Leap Year

Algorithm

1. Start the program.

2. Input a year.

3. Check divisibility by 4, 100, and 400.

4. Determine whether it is a leap year.

5. Display result.

6. Stop.

17. Get Input from User

Algorithm

1. Start the program.

2. Prompt user for input values.

3. Store values in variables.

4. Display the entered values.

5. Stop.

18. Read a CSV File and Analyze Data


Algorithm

1. Start the program.

2. Load CSV file using [Link]().

3. Store data in a data frame.

4. Display summary and structure.

5. Perform basic analysis.

6. Stop.

19. Statistical Analysis

Algorithm

1. Start the program.

2. Input or load dataset.

3. Calculate mean, median, and standard deviation.

4. Display statistical results.

5. Stop.

20. Factor

Algorithm

1. Start the program.

2. Create a vector with categorical values.

3. Convert vector into factor using factor().

4. Display factor levels.

5. Stop.

21. Math Function

Algorithm

1. Start the program.

2. Input numeric values.

3. Apply mathematical functions (sqrt, log, exp).

4. Display results.

5. Stop.
22. Class

Algorithm

1. Start the program.

2. Create variables of different data types.

3. Use class() function.

4. Display class of each variable.

5. Stop.

23. Find Sum

Algorithm

1. Start the program.

2. Input numbers or create a vector.

3. Calculate sum using sum().

4. Display the result.

5. Stop.

24. Sequence to Find Mean and Sum

Algorithm

1. Start the program.

2. Generate a sequence of numbers.

3. Calculate sum of numbers.

4. Calculate mean of numbers.

5. Display results.

6. Stop.

25. Matrix

Algorithm

1. Start the program.

2. Input matrix elements.

3. Create matrix using matrix() function.


4. Perform matrix operations.

5. Display matrix.

6. Stop.

26. Correlation and Covariance

Algorithm

1. Start the program.

2. Input two datasets.

3. Calculate covariance using cov().

4. Calculate correlation using cor().

5. Display results.

6. Stop.

27. Normal Distribution

Algorithm

1. Start the program.

2. Input mean and standard deviation.

3. Generate values using normal distribution functions.

4. Plot or display results.

5. Stop

You might also like