0% found this document useful (0 votes)
55 views12 pages

Meron Birhanu

The document provides 10 algorithms and flowcharts related to finding sums and displaying values of integers. The algorithms cover topics like finding the sum and displaying values of the first N positive integers, even/odd numbers, and performing operations on the first 10 positive integers. Flowcharts are provided to visually depict the logic of each algorithm.

Uploaded by

Meron
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)
55 views12 pages

Meron Birhanu

The document provides 10 algorithms and flowcharts related to finding sums and displaying values of integers. The algorithms cover topics like finding the sum and displaying values of the first N positive integers, even/odd numbers, and performing operations on the first 10 positive integers. Flowcharts are provided to visually depict the logic of each algorithm.

Uploaded by

Meron
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
You are on page 1/ 12

Addis Ababa Institute of Technology (AAiT)

COMPUTER PROGRAMING INDIVIDUAL


ASSINGMENT
Section: 11
NAME: Meron Birhanu
ID: UGR\2314\15

Instructor: Daniel Abebe


Submission date: July 08,2023

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

Step 4: Display the value of counter


Step 5: Increment counter by, i.e., counter = counter+1
Step 6: End
If counter
No
<=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

true Sum= Sum + i


If I< =
N I=i+1

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

Step 2: Initialize the variable i to 1


i=1
Step3: while i<=10
Step 4: if i%2==0
Step 5: print the numbers If No
i<=10
Step 6: increment value of i
Step 7: End
Yes

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

Step 2: Read the limit of the numbers, n


Step 3: Assign i=1
Step 4: Assign sum=0 Read limits
of numbers
Step 5: Repeat step 6,7&8 until i=n reaches
Step 6: if i%2==0 go to step 7
Step 7: compute sum=sum+1
Assign i=1
Step 8: compute i=i+1
Sum=0
Step 9: print the sum of even numbers, sum
Step 10: end
Yes

If i=n

No

False
If i%2==0

True

Compute sum=sum+1

i=i+1

Print sum of even numbers, sum

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

the next even number


Step 5: continue with step 3 until k<=N is reached k=k+2
Step 6: end

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

Compute sum =sum+ i

Print sum of odd


numbers, sum

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 3: initialize variables i=1


Step 4: Repeat steps 5-7 until I<=10
I =1
Step 5: Check if I is odd, if yes, then print i
Step 6: Increment value of I by 2
Step 7: go to step 4
No Is I <=10

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

Compute sum= sum + i

Print sum of odd numbers, sum

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

You might also like