Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int n,m;
- int i,j;
- int mat[50][50];
- int f[50][50];
- /*write a program that fills a matrix of integers
- M of size ( n*m) and then calculates the sum and product
- of each column and puts it in respective arrays S and P*/
- printf("donner les dimension :\t");
- scanf ("%d %d",&n,&m);
- for (i=0; i<n; i++)
- {
- for (j=0; j<m; j++)
- {
- printf("mat[%d][%d] : ",i,j);
- scanf("%d",&mat[i][j]);
- }
- }
- printf("**Matrice donnée**:\n");
- for (i=0; i<n; i++)
- {
- for (j=0; j<m; j++)
- {
- printf("%d ",mat[i][j]);
- }
- printf("\n");
- }
- printf("**Matrice Factorielle**:\n");
- for( i=0;i<n;i++){
- for(j=0;j<m;j++){
- //boucle hedhi te7seb el factoriel
- f[i][j]=1;
- for (int a=mat[i][j];a>0;a--){
- f[i][j]=a*f[i][j];
- }
- printf("%d\t",f[i][j]);
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement