PROGRAM exercice01;
VAR i,j:integer;
BEGIN
writeln('Traingled"etoile :');
FOR i:=1 TO 5 DO
BEGIN
FOR j:=1 TO 5 DO
IF(i<=j) THEN write('*') ELSE write(' ');
writeln;
END;
readln;
END.
__________________________________________________________________________________
PROGRAM exercice02;
VAR u0,u1,u,i:integer;
BEGIN
u0:=-1; {اسناد قيمة 0 للحد الاول}
u1:=-3; {اسناد قيمة 3- للحد الثاني}
writeln('le premier 10 termes du la suite U sont :');
write(u0,' ',u1,' '); {طباعة قيمة الحد الاول و الثاني للمتتالية}
FOR i:=2 TO 9 DO {تكرار الحلقة 8 مرات لإتمام الحدود المطلوبة}
BEGIN
u:=u0+2*u1; {حساب الحد الموافق لعداد الحلقة}
u1:=u; {اسناد قيمة الحد المحسوب للحد الذي سبقه}
write(u,' '); {طباعة قيمة الحد الموافق للحلقة و ترك مسافة}
END;
readln;
END.
__________________________________________________________________________________
PROGRAM exercice03;
VAR i,n,j:integer;
BEGIN
write('Entrer un valeur N:');
readln(N);
FOR i:=1 TO n DO
BEGIN
FOR j:= 1 TO i DO
write(j);
writeln;
END;
readln;
END.
__________________________________________________________________________________
PROGRAM exercice04;//////////////// utisation boucle WHILE /////////////////////
VAR i,n,f:integer;
BEGIN
write('Entrer un valeur entier N : ');
Readln(n);
i:=1;
f:=1;
WHILE i<=n DO
BEGIN
f:=f*i;
i:=i+1;
END;
writeln('Le factoriel de ',n,' est :',f);
readln;
END.
PROGRAM exercice04;//////////////// utisation boucle REPEAT /////////////////////
VAR i,n,f:integer;
BEGIN
write('Entrer un valeur entier N : ');
Readln(n);
i:=1;
f:=1;
REPEAT
f:=f*i;
i:=i+1;
UNTIL i>n;
writeln('Le factoriel de ',n,' est :',f);
readln;
END.
__________________________________________________________________________________
PROGRAM exercice05;
VAR a,b,r :integer;
BEGIN
writeln('Donnez deux valeurs positive :');
readln(a,b);
IF b=0 THEN writeln('PGCD est :',a)
ELSE
BEGIN
REPEAT
r:=a Mod b;
a:=b;
b:=r;
UNTIL b=0;
writeln('PGCD est :',a);
END;
readln ;
END.
__________________________________________________________________________________
PROGRAM exercice06;
VAR j,m,a,a1,m1,q,r,f:integer;
BEGIN
write('Entrer Jour de naissance [1-31] : ');readln(j);
write('Entrer Moi de naissance [1-12] : ');readln(m); m1:=m;
write('Entrer Annee de naissance [0-2050] : ');readln(a); a1:=a;
IF m>3 THEN
m:=m-2
ELSE
BEGIN
m:=m+10;
a:=a-1;
END;
q:=a DIV 100;
r:=a MOD 100;
f:=j+r-(2*q)+(q DIV 4)+(r DIV 4)+(26*m-2) DIV 10;
CASE(f MOD 7) OF
0:writeln('la date ',j,'/',m1,'/',a1,' Correspond a Dimanche ');
1:writeln('la date ',j,'/',m1,'/',a1,' Correspond a Lundi');
2:writeln('la date ',j,'/',m1,'/',a1,' Correspond a Mardi ');
3:writeln('la date ',j,'/',m1,'/',a1,' Correspond a Mercredi ');
4:writeln('la date ',j,'/',m1,'/',a1,' Correspond a Jeudi');
5:writeln('la date ',j,'/',m1,'/',a1,' Correspond a Vendredi');
6:writeln('la date ',j,'/',m1,'/',a1,' Correspond a Samedi');
END;
readln;
END.
_________________________________________________________________________________
PROGRAM exercice07;
VAR h,s,s1,m:integer;
BEGIN
write('Entrer le temps (second) :'); readln(s);
h:=s DIV 3600;
m:=(s MOD 3600) DIV 60;
s1:=(s MOD 3600) MOD 60;
writeln(s ,'-----> ',h,' h ',m,' m ',s1,' s ');
readln;
END.
__________________________________________________________________________________
PROGRAM exercice08;
VAR a,j,j1,s:integer;
BEGIN
write('Entrer nombre des jours : '); readln(j);
a:=j DIV 365;
s:=(j MOD 365)DIV 7;
j1:=(j MOD 365) MOD 7;
writeln(j ,'-----> ',a,' Annee(s) ',s,' semaine(s) ',j1,' jour(s) ');
readln;
END.
________________________________________________________________________________
PROGRAM exercice09;
VAR i,j:integer;
BEGIN
writeln('Carre d"etoile et diagonale vide:');
FOR i:=1 TO 6 DO
BEGIN
FOR j:=1 TO 6 DO
IF(i=j) THEN write(' ') ELSE write('*');
writeln;
END;
readln;
END.
________________________________________________________________________________
PROGRAM exercice10;
VAR a,s,i:integer;
BEGIN
writeln('Donner des nombres,tappez 0 our terminer ');
readln(a);
s:=0;
i:=0;
WHILE a <>0 DO
BEGIN
s:=s+a;
readln(a);
i:=i+1;
END;
writeln('la somme est :',s);
writeln('nombre de chiffres non nuls est :',i);
readln;
END.
____________________________________________________________________________
PROGRAM exercice11;
VAR C:Char;
BEGIN
writeln('Appuyer sur un bouton ');
readln(C);
IF C = ‘R’ OR ‘r’ THEN writeln(' ROUGE');
ELSE IF C = ‘B’ OR ‘b’ THEN writeln(' BLEU ');
ELSE IF C = ‘N’ OR ‘n’ THEN writeln(' NOIRE');
ELSE writeln(' VOTRE CLICK INVALIDE ');
readln;
END.
____________________________________________________________________________
PROGRAM exercice12;
VAR
i , j :integer;
S,P,TS,S1,S2:real;
A:byte;
BEGIN
{********************** PARTIR 1****************************}
write('Entrez Montant (DZD) : '); readln(S);
write('Entrez Numbred"annee : '); readln(A);
write('Entrez le benefice (%) s-v-p : '); readln(P);
S1:=S;
S2:=S*2;
FOR i:=1 TO A DO
S:=S+(P/100)*S;
writeln( ' le Montant totale apres le ', A ,' Ans est ', ts:02:02, ' DZD ');
{********************** PARTIR 2****************************}
j:=0;
WHILE S1< S2 DO
BEGIN
S:=S1+(P/100)*S1;
j:=j+1;
END;
writeln('le Montant est double apres ',j,' Ans');
readln;
END.