10 Simple C Program Algorithms (Step by Step)
Print Hello World
1. Start.
2. Display the message 'Hello World' on the screen.
3. Stop.
Add Two Numbers
1. Start.
2. Input two numbers.
3. Add the numbers.
4. Display the sum.
5. Stop.
Swap Two Numbers
1. Start.
2. Input two numbers.
3. Store the first number in a temporary variable.
4. Assign the second number to the first number.
5. Assign the temporary variable to the second number.
6. Display the swapped numbers.
7. Stop.
Find Largest of Three Numbers
1. Start.
2. Input three numbers.
3. Compare the first number with the second and third.
4. Find which number is the greatest.
5. Display the largest number.
6. Stop.
Check Even or Odd
1. Start.
2. Input a number.
3. Divide the number by 2.
4. If the remainder is 0, it is even.
5. Otherwise, it is odd.
6. Display the result.
7. Stop.
Find Factorial of a Number
1. Start.
2. Input a number.
3. Initialize factorial value as 1.
4. Multiply numbers from 1 to the given number.
5. Display the factorial result.
6. Stop.
Generate Fibonacci Series
1. Start.
2. Input how many terms to generate.
3. Set first two terms as 0 and 1.
4. Add the previous two terms to get the next term.
5. Repeat until the required terms are generated.
6. Display the series.
7. Stop.
Check Prime Number
1. Start.
2. Input a number.
3. Check if the number is divisible by any number other than 1 and itself.
4. If divisible, it is not prime.
5. Otherwise, it is prime.
6. Display the result.
7. Stop.
Reverse Digits of a Number
1. Start.
2. Input a number.
3. Extract the last digit.
4. Append the digit to a reverse number.
5. Remove the last digit from the original number.
6. Repeat steps 3–5 until the number becomes 0.
7. Display the reversed number.
8. Stop.
Check Palindrome (Number/String)
1. Start.
2. Input the number or string.
3. Reverse it.
4. Compare the reversed value with the original value.
5. If both are equal → it is a palindrome.
6. Otherwise → it is not a palindrome.
7. Display the result.
8. Stop.