Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.c
- // Exercice 12
- //
- // Created by Lucas Miglioranza on 26/11/15.
- // Copyright (c) 2015 Lucas Miglioranza. All rights reserved.
- //
- #include <stdio.h>
- #define N 10
- void EncoderVecteur(int [N]);
- void AfficherVecteur(int [N]);
- int ProduitVecteurs(int c[N],int d[N]);
- int main(int argc, const char * argv[])
- {
- int Tableau[N];
- int Tableau1[N];
- EncoderVecteur(Tableau);
- AfficherVecteur(Tableau);
- EncoderVecteur(Tableau1);
- printf("%d",ProduitVecteurs(Tableau,Tableau1));
- return 0;
- }
- void EncoderVecteur(int e[N])
- {
- int i;
- int a;
- int tmp;
- for (i=0;i<N;i++)
- {
- printf("\nEncodage du vecteur:");
- fflush(stdin);
- scanf("%d",&a);
- tmp = e[i];
- e[i] = a;
- }
- return;
- }
- void AfficherVecteur(int e[N])
- {
- int i;
- for (i=0;i<N;i++) printf("%3d", e[i]);
- printf("\n");
- return;
- }
- int ProduitVecteurs(int c[N],int d[N])
- {
- int i;
- int produits = 0;
- for (i=0;i<N;i++)
- {
- produits = produits + c[1]*d[1];
- }
- return (produits);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement