0% found this document useful (0 votes)
10 views1 page

6) Iterative Structure - Exercise 2 - Part 2 of 4

The document outlines a series of algorithmic exercises focused on iterative structures, including tasks such as calculating sums and averages of integers, displaying even and odd numbers, and manipulating input values. Each exercise is accompanied by a solution written in algorithmic language. The exercises aim to reinforce understanding of loops and conditional statements in programming.

Uploaded by

soufiene
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

6) Iterative Structure - Exercise 2 - Part 2 of 4

The document outlines a series of algorithmic exercises focused on iterative structures, including tasks such as calculating sums and averages of integers, displaying even and odd numbers, and manipulating input values. Each exercise is accompanied by a solution written in algorithmic language. The exercises aim to reinforce understanding of loops and conditional statements in programming.

Uploaded by

soufiene
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Algorithmic I Ch 4 : Iterative structure – 6) Exercise 2 - Part 2 of 4 2023/2024

Exercise 2 : (Course)
Write in algorithmic language a treatment for :
1- Display the sum of integer numbers that are between 1 and 100.
2- Display the even integers which are between 1 and 80 (then the odd numbers).
3- Display all natural numbers multiple of 5 that are between 1 and 100 using the 'for' loop
and the 'while' loop.
4- Display the sum of 10 integer numbers as well as their average.
5- Display the sum of n integer numbers (n>0) as well as their average.
6- Read an integer x>0, then double it as many times until it exceeds 60.
7- Display the minimum between 10 integer numbers.
8- Display the minimum between n integer numbers (n>0).
9- Calculate the sum of several given integer numbers and stop as soon as the sum
exceeds 500, then display their average.
10- Calculate the sum of several given integers, and stop when entering -1, display their
average.

Solution :

4)
S  0;
For i1 to 10 step 1 do
Print(ʺGive an integer :ʺ);
Read(x);
SS+x;
EndFor;
Avg  S / 10 ;
Print(ʺS=ʺ, S, ʺ Avg=ʺ, Avg);

5)
Repeat
Print(ʺGive n ˃0 :ʺ); Read(n);
Until (n˃0);
S  0;
For i1 to n step 1 do
Print(ʺGive an integer:ʺ); Read(x);
SS+x;
EndFor;
Avg  S / n ;
Print(ʺS=ʺ, S, ʺ Avg=ʺ, Avg);

6)
Repeat
Print (“Give an integer > 0 :“); Read(x) ;
Until (x>0) ;
While(x<=60) do
xx*2 ;
EndWhile ;
Print (“x=“, x);
Page 1 sur 1

You might also like