0% found this document useful (0 votes)
4 views

Algorithm

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)
4 views

Algorithm

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/ 2

Algorithm:max_min_prod_moy

Var

T :array[1...10],i,n,max,min,prod,som,pdd:imteger;moy:real;

Begin

Repeat Write(‘give the size of the array<=100’) ; Read(n);

Until n>0 AND N<=100;

FOR i1 to n DO;

Read(T[i]);
Done;
MaxT[1];MinT[i];som0 ;prod1 ;pdd0
FOR i1to n DO ;
If(Max<T[i]) then MaxT[i];

Else If (Min>T[i]) then MinT[i];


Eif;
Eif;
If(T[i]>0) then prodprod*T[i];
Else If (T[i]<0) then somsom+T[i];pddpdd+1
Eif
Eif
Dne;
Write(‘max =',Max,'min =',Min,'product positive =',Prod);
If (pdd>0) Then moysom\pdd; wrait(“moy=”moy)

Else wrait(“n’exest pas les nomber positif”)

Eif
Algorithm number of occurrences of a value V in T.

Var

T:erray[1…10],i,n,V,occ:integer;

Begin

Repeat Read(n) Until n>0 and n<=100;

For i1to n DO;

Read(t[i]);

Done;

Write(“done un number V”);

Read(V);

Occ0

FOR i1to n DO;

If(T[i]=V) then occocc+1

Else if(T[i]<>V) then occ(“n’ exist pas V”);

Eif

Eif

DONE;

Write(“le number of occurrences of a value V in T=”occ)

END

You might also like