1. Make a flowchart that will print your name five times;
Count | Output |
1 | Kenji Solis |
2 | Kenji Solis Kenji Solis |
3 | Kenji Solis Kenji Solis Kenji Solis |
4 | Kenji Solis Kenji Solis Kenji Solis Kenji Solis |
5 | Kenji Solis Kenji Solis Kenji Solis Kenji Solis Kenji Solis |
No
Start
Int count = 1
count >= 5
print “Kenji Solis”
count = count + 1
Stop
Yes
2. Create a flowchart that will print numbers from 1 to 5.
Int num = 1
num>=5
Stop
print num
num = num + 1
Start
Count | Output |
1 | 1 |
2 | 2 |
3 | 3 |
4 | 4 |
5 | 5 |
3. Create a flowchart that will print even numbers from 1 to N
Start
Input N
Int num = 1
num > N
num%2 == 0
print num
num = num + 1
Stop
No
Yes
Yes
No
N | num | num > N | num%2==0 | Output |
4 | 1 | 1>4 = No | 1%2==0 = No | |
| 2 | 2>4 = No | 2%2==0 = Yes | 2 |
| 3 | 3>4 = No | 3%2==0 = No | |
| 4 | 4>4 = No | 4%2==0 = Yes | 4 |
| 5 | 5>4 = Yes | 5%2==0 = No | |
4. Create a flowchart that will print even numbers from N to M
Start
Input N, M
Int num = N
num > M
num%2 == 0
print num
num = num + 1
Stop
No
Yes
Yes
No
M | N | num | num > M | num%2==0 | Output |
9 | 5 | 5 | 5>9 = No | 5%2==0 = No | |
| | 6 | 6>9 = No | 6%2==0 = Yes | 6 |
| | 7 | 7>9 = No | 7%2==0 = No | |
| | 8 | 8>9 = No | 8%2==0 = Yes | 8 |
| | 9 | 9>9 = No | 9%2==0 = Yes | |
| | 10 | 10>9 = Yes | | |
5. Create a flowchart that will get the sum of all odd numbers from N to M.
Start
Input N, M
Int sum = 0, num = N
num > M
num%2 == 0
num = num + 1
Stop
No
Yes
Yes
No
sum = sum + num
M | N | sum | num | num > M | num%2==0 | Output |
9 | 5 | 0 | 5 | 5>9 = No | 5%2==0 = No | |
| | 5 | 6 | 6>9 = No | 6%2==0 = Yes | |
| | 12 | 7 | 7>9 = No | 7%2==0 = No | |
| | | 8 | 8>9 = No | 8%2==0 = Yes | |
| | 21 | 9 | 9>9 = No | 9%2==0 = Yes | |
| | | 10 | 10>9 = Yes | | 21 |
print sum
6. Create a flowchart that will compute for the factorial of an inputted number.
Start
Input x
Int fact = 1,
i = 1
I > x
i = i +1
Stop
Yes
No
fact = fact * i
print fact
x | fact | i | i>x | output |
5 | 1 | 1 | 1>5 = no | |
| 1 | 2 | 2>5 = no | |
| 2 | 3 | 3>5 = no | |
| 6 | 4 | 4>5 = no | |
| 24 | 5 | 5>5 = no | |
| 120 | | 6>5 = yes | 120 |
7. Create a flowchart to find the sum of the digits of a given number. Display the sum.
Start
Input x
Int sum = 0
x <= 0
sum = sum + digit
Stop
Yes
No
digit = x % 10
print sum
x = x / 10
x | sum | x <= 0 | digit | output |
15 | 0 | 15<=0 = no | 5 | |
1 | 5 | 1<=0 = no | 1 | |
0 | 6 | 0<=0 = yes | | 6 |
8. Create a flowchart that will display the first n terms of the Fibonacci series.
Start
Input n
Int a = 0, b = 1, count = 1
count > n
nxt = a + b
Stop
Yes
No
print a
a = b
b = nxt
count = count + 1
n | a | b | count | count > n | nxt | output |
5 | 0 | 1 | 1 | 1>5 = no | 1 | 0 |
| 1 | 1 | 2 | 2>5 = no | 2 | 1 |
| 1 | 2 | 3 | 3>5 = no | 3 | 1 |
| 2 | 3 | 4 | 4>5 = no | 5 | 2 |
| 3 | 5 | 5 | 5>5 = no | 8 | 3 |
| | | | 6>5 = yes | | |
9. Create a flowchart that determine whether the inputted number is a prime number or not.
N | i | Flag | N<=0 | N==1 | i<=N/2 | N%i==0 | Flag==0 | Output |
3 | 2 | 0 | no | no | no | | yes | prime |
10. Create a flowchart that will convert decimal number to binary numbers.
Dec | Bin | Dec > 0 | R | Output |
13 | | yes | 1 | |
6 | 1 | yes | 0 | |
3 | 01 | yes | 1 | |
1 | 101 | yes | 1 | |
0 | 1101 | no | | 1101 |
| | | | |