Add FramaC TDM
This commit is contained in:
parent
713e8d12c4
commit
56e86b4b20
9 changed files with 606 additions and 0 deletions
17
content/conception_formelle/99-DM_framac/code/max_dist.c
Normal file
17
content/conception_formelle/99-DM_framac/code/max_dist.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "max_dist.h"
|
||||
|
||||
int max_dist(int *tab, unsigned int n)
|
||||
{
|
||||
int min = tab[0];
|
||||
int max = tab[0];
|
||||
unsigned int i = 1;
|
||||
while (i < n)
|
||||
{
|
||||
if (tab[i] < min)
|
||||
min = tab[i];
|
||||
if (tab[i] > max)
|
||||
max = tab[i];
|
||||
i++;
|
||||
}
|
||||
return max - min;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue