TD 03
TD 03
TD 03
Academic year: 2024/2025 – First Semester اﻟﺴﺪا� اﻷول
ي - 2025/2024 : اﻟﺴﻨﺔ اﻟﺪراﺳ�ﺔ
Module: Computer science �اﻵ
ﻣﻘ�ﺎس اﻹﻋﻼم ي
Propose algorithms that uses these instructions اﻗ�ح ﺧﻮارزﻣ�ﺎت �ﺴﺘﺨﺪم ﻫﺬە اﻟﺘﻌﻠ�ﻤﺎت ﻟﺮﺳﻢ اﻷﺷكﺎل ت
to draw the following forms: :اﻟﺘﺎﻟ�ﺔ
• A square of side length of 5 5 • ﻣ��ــﻊ ﻃﻮل ﺿﻠﻌﻪ
• An equilateral triangle with side length of 7 7 • ﻣﺜﻠﺚ ﻣتﺴﺎوي اﻷﺿﻼع ﻃﻮل ﺿﻠﻌﻪ
Exercise 02: اﻟﺘﻤ��ﻦ ن
:اﻟﺜﺎي
ي
Propose an algorithm that compute the ت
اﻗ�ح ﺧﻮارزﻣ�ﺔ �ﺴﻤﺢ بﺤﺴﺎب ﻣﺴﺎﺣﺔ
R
surface area (4πR2) and the volume ( ﻛﺮة ﻧﺼﻒ4/3 πR3) ( وﺣﺠﻢ4πR2)
(4/3πR3) of a sphere with radius R. .R ﻗﻄﺮﻫﺎ
start
m 0
input n
while n ≠ 0 do
r n modulo 10
m m*10 + r
n n / 10
endWhile
print m
end