• Aucun résultat trouvé

(1)Program 27mai201314h

N/A
N/A
Protected

Academic year: 2022

Partager "(1)Program 27mai201314h"

Copied!
3
0
0

Texte intégral

(1)

Program 27mai201314h;

uses wincrt;

var n:longint;

procedure saisie(var n:longint);

begin repeat write('N= ');

readln(n);

until n>10;

end;

function palindrome(n:longint):boolean;

var i:integer;

test:boolean;

ch:string;

begin str(n,ch);

i:=0;

repeat i:=i+1;

if ch[i]=ch[length(ch)-i+1] then test:=true else test:= false;

until (test=false) or (i= length(ch) div 2);

palindrome:=test;

(2)

end;

function inverser(n:longint):longint;

var

i,x,e:integer;

ch:string;

aux:char;

begin str(n,ch);

for i:=1 to length(ch) div 2 do begin

aux:=ch[i];

ch[i]:=ch[length(ch)-i+1];

ch[length(ch)-i+1] := aux;

end;

val(ch,x,e);

inverser:=x;

end;

procedure affiche(var n:longint);

var i:integer;

s,k:longint;

test:boolean;

begin write(n,' ');

i:=0;

repeat

(3)

i:=i+1;

k:=inverser(n);

s:=n+k;

write(s,' ');

n:=s;

if palindrome(n)=true then test:=true else test:=false;

until (test=true) or(i>=10);

if test=true then write('Cette suite est palindromique ')

else write('Le calcul de 11 termes ne donne pas une palindromique');

end;

begin saisie(n);

affiche(n);

end.

Références

Documents relatifs

[r]

[r]

[r]

[r]

[r]

◊ remarque : l'inductance est plus grande avec le noyau de fer feuilleté (aimantation induite) ; elle est un peu plus faible avec un noyau de métal non feuilleté (champ magnétique

• Pour le calcul des incertitudes sur cette relation théorique, même si on a utilisé des résistances théorique- ment égales, il faut tenir compte du fait qu'on a utilisé

[r]