Meron Birhanu
Meron Birhanu
1
1, The algorithm and the flowchart to the first 10
positive integer
Start
Step 1: Begin
Step 2: Assign counter=1
Step 3: Repeat step 4 to step until counter is <=10 Counter =1
Yes
Display counter
Counter
=counter=1
End
2
2, The algorithm and flowchart to the sum of the
first N positive integer
step 1: Start
Step 2: Input value N Start
step 3: Initialize the sum of variables sum=0
step 4: Calculate the sum of for i in range (1, N+1)
I=1, Sum=0
sum=sum +i
step 5: Print the sum
step 6: End
Read N
Print sum
End
3
3. The algorism and flowchart to display the first N
positive integer
Step1: Start
Start
Step 2: input N
Step 3: initialize a variable i with value 1
Step 4: Repeat step 5 & 6 until i is <= N
Input N
Step 5: Display the value of i
Step 6: increment i by 1
Step 7: End i=1
Yes No
i>N
Print I
i=i+1
End
4
4.The algorithm and flowchart to find the sum of
even numbers from the first 10 positive integer
Step 1: start Start
Step 2: i=1
Step 3 sum=0 i=1
Step 4: if (i%2==0) then go to step 5 else go to
Step 6 Sum=1
Step 5: sum=sum+1
Step 6: I =i+1
Step 7: if (I <=10) then go to step 4
If (i%2==0)
Step 8: Display sum
Step 9: End
False
True Sum=sum+1
i=i+1
If
(i<=1)
0)
Display sum
Stop
5
5. The algorithm and flowchart to display even
numbers from the first 10 positive integer
Step 1: start Start
No
If i
%2==0
Yes
Print i
i=i+1
End
6
6. The algorithm and flowchart to find the sum of
even numbers from the first N positive integer.
Step 1: Start Start
If i=n
No
False
If i%2==0
True
Compute sum=sum+1
i=i+1
End
7. The algorithm and flowchart to display
even numbers from the first N positive integer
Start
Step 1: Start
Step 2: initialize a variable number
to 2 which represents the first even numbers
K=2
Step 3: print the value of k which represents
the total number of even numbers to display
Step 4: increment the number b 2 to get Print k
True
If k<10
False
End
8
8, The algorithm and flowchart to find the sum of
the first odd numbers from the first 10 positive
integers
Step 1: Start
Start
Step 2: Set variable “sum” to 0
Step 3: Set variable “count” to 1
Step 4: Repeat the following until “count” reaches 10: Assign i=10
Check if “count” is odd Sum =0
If it is odd add the value of “count” to the sum variable
Increment the value of “count” by 1
Step 5: display the value of the “sum: variable as the sum of odd numbers
If i=10
Step 6: stop
reached
If i%2!
=0
9 Stop
9.The algorithm and flowchart to display odd
numbers from the first 10 positive integers
Step 1: start
Step 2: Take input value of N Start
Step 8: stop
Yes
Display i
I =I +2
Stop
10
10. The algorithm and flowchart to find the sum of
odd numbers from the first N positive integers
Step 1: initiate the variable, sum=0 Start
Step 2: take user input for value of N
Step 3: iterate through each number from 1 to N
Step 4: check if i is an odd number Assign i=1
Sum=0
Step 5: Add i to the variable sum=sum + i
Step 6: Display the sum of odd numbers
Step 7: end
If i=N
Reached
If i%2!
==0
End
11
11, The Algorism and flow chart to display odd
numbers from the first N positive integer.
Step 1: start
Start
Step 2: Take input value of N
Step 3: Initialize variable i=1
Step 4: Repeat steps 5-7 until it reaches i<=N Input N
Step 5: Check if I is odd, if yes then print i
Step 6: Increment value of I by 2
Set i=1
Step 7: Go to step 7
Step 8: End
Yes
If i>N
No
Yes
If i+2>=1 Print i
No
i=i+1
End
12