Blog

  • 3.c

    #include <stdio.h>

    int main()

    {

        int i,j,r,c,sum;

        printf(“Enter number of rows and coloumns\n”);

        scanf(“%d%d”, &r, &c);

        int m1[r][c];

        printf(“Enter the elements of matrix :\n”);

        for(i=0; i<r; i++) {

            for(j=0; j<c; j++) {

                scanf(“%d”,&m1[i][j]);

            }

        }

        printf(“Entered matrices is: \n”);

        for(i=0; i<r; i++) {

            for(j=0; j<c;j++) {

                printf(“%d “,m1[i][j]);

            }

        printf(“\n”);

        }

    //LOGIC PART

        for(i=0; i<r; i++) {

            sum=0;

            for(j=0; j<c;j++) {

                sum += m1[i][j];

            }

            printf(“The sum of number %d row is : %d\n”,i+1,sum);

        }

        for(i=0; i<r; i++) {

            sum=0;

            for(j=0; j<c;j++) {

                sum += m1[j][i];

            }

            printf(“The sum of number %d column is : %d\n”,j+1,sum);

        }

        return 0;

    }

  • 2.c

    #include <stdio.h>

    int main()

    {

        int i,j,r,c,Ecount=0, Ocount=0;

        printf(“Enter number of rows and coloumns\n”);

        scanf(“%d%d”, &r, &c);

        int m1[r][c];

        printf(“Enter the elements of matrix :\n”);

        for(i=0; i<r; i++) {

            for(j=0; j<c; j++) {

                scanf(“%d”,&m1[i][j]);

            }

        }

        printf(“Entered matrices is: \n”);

        for(i=0; i<r; i++) {

            for(j=0; j<c;j++) {

                printf(“%d “,m1[i][j]);

            }

        printf(“\n”);

        }

        for(i=0; i<r; i++) {

            for(j=0; j<c;j++) {

                if(m1[i][j]%2==0)

                Ecount++;

                else{

                Ocount++;

                }

            }

        }

            printf(“The Even elements are :%d and odd elements are : %d”,Ecount, Ocount);

        return 0;

    }

  • 1.c

    #include <stdio.h>

    int main()

    {

        int i,j,r,c;

        printf(“Enter number of rows and coloumns\n”);

        scanf(“%d%d”, &r, &c);

        int m1[r][c];

        printf(“Enter the elements of matrix:\n”);

        for(i=0; i<r; i++) {

            for(j=0; j<c; j++) {

                scanf(“%d”,&m1[i][j]);

            }

        }

        printf(“Entered matrices is: \n”);

        for(i=0; i<r; i++) {

            for(j=0; j<c;j++) {

                printf(“%d “,m1[i][j]);

            }

        printf(“\n”);

        }

        return 0;

    }

  • Hello world!

    Welcome to WordPress. This is your first post. Edit or delete it, then start writing!