Journey Roadmap To Problem Solving
Journey Roadmap To Problem Solving
1. Understand Flowcharts
6. Code Consistently
Algorithm:
1. Start
2. Read number n
3. Initialize factorial to 1
4. For i from 1 to n
○ Multiply factorial by i
5. Print factorial
6. End
Flowchart:
1. Start → Oval
2. Read n → Parallelogram
3. Initialize factorial = 1 → Rectangle
4. For i = 1 to n → Rectangle
○ Multiply factorial by i → Rectangle
5. Print factorial → Parallelogram
6. End → Oval
CODE 👏
#include <stdio.h>
int main() {
int n, i;
unsigned long long factorial = 1; // Use long long for larger factorials
return 0;
}
Dry Run:
1. Input: n = 5
2. Initialize factorial = 1
3. Loop:
○ i = 1, factorial = 1 * 1 = 1
○ i = 2, factorial = 1 * 2 = 2
○ i = 3, factorial = 2 * 3 = 6
○ i = 4, factorial = 6 * 4 = 24
○ i = 5, factorial = 24 * 5 = 120
4. Output: Factorial of 5 = 120
● Feel free to ask for specific problems you want to solve, and I can help guide you
through them.
Consistency:
● Aim to solve at least one problem a day and gradually increase the complexity.
Reading Books:
● Use the recommended books to reinforce your understanding and find more
exercises to practice.
By following this roadmap, you'll develop strong problem-solving skills and become proficient
in programming.