Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define M 3
- #define N 2
- void prodotto(double *mat,double *A,double *array){
- for (int i=0;i<M;i++){
- double somma=0;
- for (int j=0;j<N;j++){
- somma += (*(mat+N*i+j))*(*(A+j));
- }
- *(array+i)=somma;
- }
- return;
- }
- int main(){
- double mat[M][N];
- double A[N]={2,3};
- double array[M];
- for (int i=0;i<M;i++){
- for (int j=0;j<N;j++){
- printf("Inserisci mat[%d][%d]= ",i,j);
- scanf("%lf",mat+N*i+j);
- }
- }
- prodotto(mat,A,array);
- printf("\n");
- for (int k=0;k<M;k++){
- printf("%lf",array[k]);
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement