C

De bricosoft
Aller à la navigation Aller à la recherche
<google uid="C08" position="left"></google>
Erreur dans le widget Twitter Search: unable to write file /home/gbp4dt5/zones/bricosoft.com/www/extensions/Widgets/compiled_templates/wrt69699cbc0f9166_57258904
Erreur dans le widget Twitter: unable to write file /home/gbp4dt5/zones/bricosoft.com/www/extensions/Widgets/compiled_templates/wrt69699cbc16eab4_43955903
Fichier:C.png
Fichier:C.jpg
Fichier:C.gif
Fichier:C.svg

Le C est un langage de programmation impératif.

Codes sources en vrac

Produit de deux matrices

<source lang="c">

  1. include <stdio.h>
  1. define N 10

void produit(float a[N][N], float b[N][N], float c[N][N], int nla, int nca, int nlb, int ncb) { int i, j, k;

for (i = 0; i < ncb ; i++) for (j = 0; j < nla ; j++) { c[j][i] = 0; for (k = 0; k < nca; k++) c[j][i] = a[j][k] * b[k][i] + c[j][i]; } }

void affiche_matrice(float d[N][N], int nld, int ncd);

int main (void) { float a[N][N] = { { 1 , 2 , 0, 4 } , { 3 , 1 , 2, 1 } }; float b[N][N] = { { 1, 2, 1 }, { 3, 0, 2 }, { 1, 2, 0 }, { 1, 4, 1 } }; float c[N][N];

produit( a, b, c, 2, 4, 4, 3 );

affiche_matrice(a, 2, 4);

affiche_matrice(b, 4, 3);

affiche_matrice(c, 2, 3); }

void affiche_matrice(float d[N][N], int nld, int ncd) { int i, j;

for ( i=0; i<nld; i++) { printf ("|"); for (j=0; j<ncd; j++)

			printf (" %.0lf |", d[i][j]);
		printf("\n");

} printf("\n"); } </source>

Liens

Erreur dans le widget DISQUS: Unable to load template 'wiki:DISQUS'