SlideShare a Scribd company logo
1 of 2
Download to read offline
Use 2dimensional arrays to represent matrices
Solution
import java.util.*;
import java.lang.*;
import java.io.*;
class lab5c
{
public static void main (String[] args)
{
int[][] A = {{10,55,4,89,39},{45,9,49,98,23},{4,8,90,23,9},{8,37,80,2,31}};
int[][] B = {{40,1,16},{90,3,7},{9,2,22},{44,35,60},{18,67,21}};
int[][] C = {{0,0,0},{0,0,0},{0,0,0},{0,0,0}};
int sum = 0;
for(int i=0;i<=4;i++)
{
sum = sum + A[2][i] * B[i][1];
System.out.println(sum);
}
C[2][1] = sum;
System.out.println("C[2][1] = "+C[2][1]);
}
}
output:

More Related Content

More from archgeetsenterprises

Describe two methods for communicating the material in an Informatio.pdf
Describe two methods for communicating the material in an Informatio.pdfDescribe two methods for communicating the material in an Informatio.pdf
Describe two methods for communicating the material in an Informatio.pdf
archgeetsenterprises
 
Describe the following structuresfunctions or cells Dermal, vascul.pdf
Describe the following structuresfunctions or cells  Dermal, vascul.pdfDescribe the following structuresfunctions or cells  Dermal, vascul.pdf
Describe the following structuresfunctions or cells Dermal, vascul.pdf
archgeetsenterprises
 
Describe the accounting and finance structure in an organization..pdf
Describe the accounting and finance structure in an organization..pdfDescribe the accounting and finance structure in an organization..pdf
Describe the accounting and finance structure in an organization..pdf
archgeetsenterprises
 
Compare the views of Piaget and Vygotsky on school instruction in ab.pdf
Compare the views of Piaget and Vygotsky on school instruction in ab.pdfCompare the views of Piaget and Vygotsky on school instruction in ab.pdf
Compare the views of Piaget and Vygotsky on school instruction in ab.pdf
archgeetsenterprises
 
a) Research information about the U.S. Governments bailouts. Locat.pdf
a) Research information about the U.S. Governments bailouts. Locat.pdfa) Research information about the U.S. Governments bailouts. Locat.pdf
a) Research information about the U.S. Governments bailouts. Locat.pdf
archgeetsenterprises
 

More from archgeetsenterprises (20)

Glial cells were originally thought to play a very minor role in the .pdf
Glial cells were originally thought to play a very minor role in the .pdfGlial cells were originally thought to play a very minor role in the .pdf
Glial cells were originally thought to play a very minor role in the .pdf
 
Fungal reproductive cycle. Place the appropriate label in the correct.pdf
Fungal reproductive cycle. Place the appropriate label in the correct.pdfFungal reproductive cycle. Place the appropriate label in the correct.pdf
Fungal reproductive cycle. Place the appropriate label in the correct.pdf
 
Explain the concept of distributive justiceSolutiondistributiv.pdf
Explain the concept of distributive justiceSolutiondistributiv.pdfExplain the concept of distributive justiceSolutiondistributiv.pdf
Explain the concept of distributive justiceSolutiondistributiv.pdf
 
Fecal-oral infections are often a result of _____ droplet transmissi.pdf
Fecal-oral infections are often a result of _____  droplet transmissi.pdfFecal-oral infections are often a result of _____  droplet transmissi.pdf
Fecal-oral infections are often a result of _____ droplet transmissi.pdf
 
Dr. Z conducts a study examining the effect of socioeconomic status .pdf
Dr. Z conducts a study examining the effect of socioeconomic status .pdfDr. Z conducts a study examining the effect of socioeconomic status .pdf
Dr. Z conducts a study examining the effect of socioeconomic status .pdf
 
Double branded DNA viruses (select only one answer) all insert their.pdf
Double branded DNA viruses (select only one answer)  all insert their.pdfDouble branded DNA viruses (select only one answer)  all insert their.pdf
Double branded DNA viruses (select only one answer) all insert their.pdf
 
Discuss the mechanisms by which antibiotic resistance genes can be h.pdf
Discuss the mechanisms by which antibiotic resistance genes can be h.pdfDiscuss the mechanisms by which antibiotic resistance genes can be h.pdf
Discuss the mechanisms by which antibiotic resistance genes can be h.pdf
 
Develop two biologically relevant and researchable questions comparin.pdf
Develop two biologically relevant and researchable questions comparin.pdfDevelop two biologically relevant and researchable questions comparin.pdf
Develop two biologically relevant and researchable questions comparin.pdf
 
Describe two methods for communicating the material in an Informatio.pdf
Describe two methods for communicating the material in an Informatio.pdfDescribe two methods for communicating the material in an Informatio.pdf
Describe two methods for communicating the material in an Informatio.pdf
 
Describe the following structuresfunctions or cells Dermal, vascul.pdf
Describe the following structuresfunctions or cells  Dermal, vascul.pdfDescribe the following structuresfunctions or cells  Dermal, vascul.pdf
Describe the following structuresfunctions or cells Dermal, vascul.pdf
 
Describe the accounting and finance structure in an organization..pdf
Describe the accounting and finance structure in an organization..pdfDescribe the accounting and finance structure in an organization..pdf
Describe the accounting and finance structure in an organization..pdf
 
Consider an assembly of thousands of people, all screaming, yelling,.pdf
Consider an assembly of thousands of people, all screaming, yelling,.pdfConsider an assembly of thousands of people, all screaming, yelling,.pdf
Consider an assembly of thousands of people, all screaming, yelling,.pdf
 
Concrete and cementI) Give an example of non-calcium silicate cem.pdf
Concrete and cementI) Give an example of non-calcium silicate cem.pdfConcrete and cementI) Give an example of non-calcium silicate cem.pdf
Concrete and cementI) Give an example of non-calcium silicate cem.pdf
 
Compute the total interest and the monthly payments for an add-on i.pdf
Compute the total interest and the monthly payments for an add-on i.pdfCompute the total interest and the monthly payments for an add-on i.pdf
Compute the total interest and the monthly payments for an add-on i.pdf
 
Compare the views of Piaget and Vygotsky on school instruction in ab.pdf
Compare the views of Piaget and Vygotsky on school instruction in ab.pdfCompare the views of Piaget and Vygotsky on school instruction in ab.pdf
Compare the views of Piaget and Vygotsky on school instruction in ab.pdf
 
Can molds be unicellular If so, in what conditions and under what c.pdf
Can molds be unicellular If so, in what conditions and under what c.pdfCan molds be unicellular If so, in what conditions and under what c.pdf
Can molds be unicellular If so, in what conditions and under what c.pdf
 
Calculate the following cross exchange ratesThe dollar is trading.pdf
Calculate the following cross exchange ratesThe dollar is trading.pdfCalculate the following cross exchange ratesThe dollar is trading.pdf
Calculate the following cross exchange ratesThe dollar is trading.pdf
 
Bouchard Companys stock sells for $21 per share, its last dividen.pdf
Bouchard Companys stock sells for $21 per share, its last dividen.pdfBouchard Companys stock sells for $21 per share, its last dividen.pdf
Bouchard Companys stock sells for $21 per share, its last dividen.pdf
 
Answer the following question please.The answers I have is wrong, .pdf
Answer the following question please.The answers I have is wrong, .pdfAnswer the following question please.The answers I have is wrong, .pdf
Answer the following question please.The answers I have is wrong, .pdf
 
a) Research information about the U.S. Governments bailouts. Locat.pdf
a) Research information about the U.S. Governments bailouts. Locat.pdfa) Research information about the U.S. Governments bailouts. Locat.pdf
a) Research information about the U.S. Governments bailouts. Locat.pdf
 

Recently uploaded

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 

Recently uploaded (20)

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 

Use 2dimensional arrays to represent matricesSolutioni.pdf

  • 1. Use 2dimensional arrays to represent matrices Solution import java.util.*; import java.lang.*; import java.io.*; class lab5c { public static void main (String[] args) { int[][] A = {{10,55,4,89,39},{45,9,49,98,23},{4,8,90,23,9},{8,37,80,2,31}}; int[][] B = {{40,1,16},{90,3,7},{9,2,22},{44,35,60},{18,67,21}}; int[][] C = {{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; int sum = 0; for(int i=0;i<=4;i++) { sum = sum + A[2][i] * B[i][1]; System.out.println(sum); } C[2][1] = sum; System.out.println("C[2][1] = "+C[2][1]); }