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


#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=o;i<10;i++)
{
printf("%d",i);
}
}

output:
0
1
2
3
4
5
6
7
8
9
12-08-24, 2:41 p.m. 238T1A05D9


#include<stdio.h>
#include<conio.h>
int main()
{
    int i;
    for(i=0;i<10i++)
    {
        printf("i");
     }
  return 0;
}

    output:  
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
12-08-24, 2:44 p.m. Nikki5D4


#include<stdio.h>
#include<conio.h>
int main()
{
    int i;
    for(i=0;i<10i++)
    {
        printf("i");
     }
  return 0;
}

    output:  
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
12-08-24, 3:15 p.m. tanmayi.P


#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=o;i<10;i++)
{
printf("%d",i);
}
}

output:
0
1
2
3
4
5
6
7
8
9
12-08-24, 3:16 p.m. 238T1A05D3


#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=0;i<=10;i++)
{
printf("%d",i);
}
}

output:
0
1
2
4
5
6
7
8
9
12-08-24, 3:27 p.m. Shalini_09


#include<stdio.h>
#include<conio.h>
int main()
{
    int i;
    for(i=0;i<10i++)
    {
        printf("i");
     }
  return 0;
}
12-08-24, 3:28 p.m. 238T1A05D8


#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=0;i<10;i++)
{
printf("%d\n",i);
}
getch();
}
putput
0
1
2
3
4
5
6
7
8
9

12-08-24, 4:22 p.m. 238T1A05G7


#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=0;i<10;i++)
{
printf("%d\n",i);
}
getch();
}
putput
0
1
2
3
4
5
6
7
8
9
16-08-24, 5:01 p.m. 238T1A05F5


#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=0;i<10;i++)
{
printf("%d\n",i);
}
getch();
}
putput
0
1
2
3
4
5
6
7
8
9
19-08-24, 3:18 p.m. nasreensk2005@gmail.com


#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=0;i<10;i++)
{
printf("%d\n",i);
}
getch();
}

output:
0
1
2
3
4
5
6
7
8
9
19-08-24, 3:49 p.m. 238T1A05G1


Log-in to answer to this question.