saving . . . saved Matrix has been deleted. Matrix has been hidden .
Matrix
Title
Question
#include <stdio.h>

int main()
{
    int rowCount, columnCount, i, j;
    int firstMatrix[10][10], secondMatrix[10][10], resultMatrix[10][10];

    printf("Number of rows of matrices to be subtracted : ");
    scanf("%d", &rowCount);

    printf("Number of columns matrices to be subtracted : ");
    scanf("%d", &columnCount);

    printf("Elements of first matrix : \n");

    for (i = 0; i < rowCount; i++)
        for (j = 0; j < columnCount; j++)
            scanf("%d", &firstMatrix[i][j]);

    printf("Elements of second matrix : \n");

    for (i = 0; i < rowCount; i++)
        for (j = 0; j < columnCount; j++)
            scanf("%d", &secondMatrix[i][j]);

    printf("Difference of entered matrices : \n");

    for (i = 0; i < rowCount; i++)
    {
        for (j = 0; j < columnCount; j++)
        {
            resultMatrix[i][j] = firstMatrix[i][j] - secondMatrix[i][j];
            printf("%d\t",resultMatrix[i][j]);
        }
        printf("\n");
    }

    return 0;
}



By
N.L.Pooja
Ece department
IRTT

C-and-Cpp Loops 04-05 min 50-60 sec 06-12-21, 9:56 p.m. Poojanl

Answers:

Assignments are only for self-assessment. If you have any specific question related to this tutorial please post here.
10-01-22, 5:15 p.m. hbammkanti


Program in c to print 0 to 9 using for loop:

int main() 
{
    int x = 0;
    for(x;(x<10);x++)
    {
        printf("%d\n",x);
    }
    return 0;
}

Output:

0
1
2
3
4
5
6
7
8
9


Program in cpp to print 0 to 9 using for loop:

#include <iostream>
using namespace std;
int main() 
{
    int x = 0;
    for(x;(x<10);x++)
    {
        cout<<x<<"\n";
    }
    return 0;
}

Output:

0
1
2
3
4
5
6
7
8
9





24-01-24, 2:24 p.m. Vaishnavi2885


Log-in to answer to this question.