हिंदी माध्यम नोट्स
Class 6
Hindi social science science maths English
Class 7
Hindi social science science maths English
Class 8
Hindi social science science maths English
Class 9
Hindi social science science Maths English
Class 10
Hindi Social science science Maths English
Class 11
Hindi sociology physics physical education maths english economics geography History
chemistry business studies biology accountancy political science
Class 12
Hindi physics physical education maths english economics
chemistry business studies biology accountancy Political science History sociology
English medium Notes
Class 6
Hindi social science science maths English
Class 7
Hindi social science science maths English
Class 8
Hindi social science science maths English
Class 9
Hindi social science science Maths English
Class 10
Hindi Social science science Maths English
Class 11
Hindi physics physical education maths entrepreneurship english economics
chemistry business studies biology accountancy
Class 12
Hindi physics physical education maths entrepreneurship english economics
chemistry business studies biology accountancy
Write a program to add two matrix with function , subtract two Matric with function , transpose a matrix
इससे पहले के article मे function को array और struture के साथ use करने के method को discuss किया गया है | अब इस article मे , array और struture के कुछ उदाहरनो को discuss करेगे |
उदाहरन -1
Write a program to add two matrix with function .
इस उदाहरन मे , function द्वारा दो matrix को add किया जाता है |
Explanation
किसी matrix को implement करने के लिए two dimensional array को use किया जाता है | two level looping को भी use किया जता है |
1.सबसे पहले दो two dimensional array को declare किया जाता है | इसके बाद यूजर द्वारा दो array के elements को input किया जाता है |
2.looping होती है :-
इस loop से two dimensional array मे यूजर द्वारा input किये गये value को read किया जाता है |
3.इसके बाद addition() function array को pass किया जाता है |
3. उसके बाद addition() से प्राप्त को array variable ‘c’ मे assign किया जाता है |
addition () मे
addition() मे दोनों array variable को array variable ‘a’ और ‘b’ मे initial किया जता है |
looping की जाती है :-
इसमें int c[i][j] = a[i][j]+b[i][j] से addition को calculate किया जाता ही |
इसके बाद मर्त्रिक्स ‘c’ को return किया जता है |
Source code
#include<iostream.h>
#include<conio.h>
void add (int first[3][3] , int second [3][3] );
void main()
{
int first[3][3];
cout<<“Enter First Matrix Element : “;
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
cin>>first[i][j];
}
int second[3][3];
cout<<“Enter Second Matrix Element : “;
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
cin>>second[i][j];
}
int output[3][3];
output = add(first , second ) ;
cout<<“Addition Matrix :”;
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
cout<<output[i][j];
}
}
getch();
}
void add(int a[][] ,int b[][])
{
int o[3][3];
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
o[i][j]=a[i][j]+b[i][j];
}
}
return o;
}
उदाहरन -2
Write a program to subtract two Matric with function .
इस उदाहरन मे , function द्वारा दो matrix को subtract किया जाता है |
Explanation
किसी matrix को implement करने के लिए two dimensional array को use किया जाता है | two level looping को भी use किया जता है |
1.सबसे पहले दो two dimensional array को declare किया जाता है | इसके बाद यूजर द्वारा दो array के elements को input किया जाता है |
2.looping होती है :-
इस loop से two dimensional array मे यूजर द्वारा input किये गये value को read किया जाता है |
3.इसके बाद sub() function array को pass किया जाता है |
3. उसके बाद sub() से प्राप्त को array variable ‘c’ मे assign किया जाता है |
subition () मे
subition() मे दोनों array variable को array variable ‘a’ और ‘b’ मे initial किया जता है |
looping की जाती है :-
इसमें int c[i][j] = a[i][j] – b[i][j] से subtract को calculate किया जाता ही |
इसके बाद मर्त्रिक्स ‘c’ को return किया जता है |
Source code
#include<iostream.h>
#include<conio.h>
void sub (int first[3][3] , int second [3][3] );
void main()
{
int first[3][3];
cout<<“Enter First Matrix Element : “;
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
cin>>first[i][j];
}
int second[3][3];
cout<<“Enter Second Matrix Element : “;
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
cin>>second[i][j];
}
int output[3][3];
output = sub(first , second ) ;
cout<<“subtract Matrix :”;
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
cout<<output[i][j];
}
}
getch();
}
void sub(int a[][] ,int b[][])
{
int o[3][3];
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
o[i][j]=a[i][j]-b[i][j];
}
}
return o;
}
उदाहरन -3
Write a program to transpose a matrix with function .
इस उदाहरन मे , function द्वारा दो matrix को transpose tract किया जाता है |
Explanation
किसी matrix को implement करने के लिए two dimensional array को use किया जाता है | two level looping को भी use किया जता है |
1.सबसे पहले एक two dimensional array को declare किया जाता है | इसके बाद यूजर द्वारा array के elements को input किया जाता है |
2.looping होती है :-
इस loop से two dimensional array मे यूजर द्वारा input किये गये value को read किया जाता है |
3.इसके बाद transpose() function array को pass किया जाता है |
3. उसके बाद transpose() से प्राप्त को array variable ‘c’ मे assign किया जाता है |
transposeition () मे
transposeition() मे दोनों array variable को array variable ‘a’ मे initial किया जता है |
looping की जाती है :-
इसमें int c[i][j] = a[j][i] से transpose को calculate किया जाता ही |
इसके बाद matrix ‘c’ को return किया जता है |
Source code
#include<iostream.h>
#include<conio.h>
void transpose (int first[3][3]);
void main()
{
int first[3][3];
cout<<“Enter Matrix Element : “;
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
cin>>first[i][j];
}
int output[3][3];
output = transpose(first ) ;
cout<<“transpose Matrix :”;
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
cout<<output[i][j];
}
}
getch();
}
void transpose(int a[][])
{
int o[3][3];
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
o[i][j]=a[j][i];
}
}
return o;
}
उदाहरन -4
Write a program to dividetwo matrix with function .
इस उदाहरन मे , function द्वारा दो matrix को divideकिया जाता है |
Explanation
किसी matrix को implement करने के लिए two dimensional array को use किया जाता है | two level looping को भी use किया जता है |
1.सबसे पहले दो two dimensional array को declare किया जाता है | इसके बाद यूजर द्वारा दो array के elements को input किया जाता है |
2.looping होती है :-
इस loop से two dimensional array मे यूजर द्वारा input किये गये value को read किया जाता है |
3.इसके बाद div() function array को pass किया जाता है |
3. उसके बाद div() से प्राप्त को array variable ‘c’ मे assign किया जाता है |
subition () मे
subition() मे दोनों array variable को array variable ‘a’ और ‘b’ मे initial किया जता है |
looping की जाती है :-
इसमें int c[i][j] = a[i][j] / b[i][j] से divide को calculate किया जाता ही |
इसके बाद मर्त्रिक्स ‘c’ को return किया जता है |
Source code
#include<iostream.h>
#include<conio.h>
void div(int first[3][3] , int second [3][3] );
void main()
{
int first[3][3];
cout<<“Enter First Matrix Element : “;
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
cin>>first [i][j];
}
int second[3][3];
cout<<“Enter Second Matrix Element : “;
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
cin>>second[i][j];
}
int output[3][3];
output = div(first , second ) ;
cout<<“divide Matrix :”;
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
cout<<output[i][j];
}
}
getch();
}
void div(int a[][] ,int b[][])
{
int o[3][3];
for(i=0;i<3;i++)
{
for(j=0;j,3;j++)
{
o[i][j]=a[i][j] / b[i][j];
}
}
return o;
}
इस article मे array को function के साथ इस्तेमाल करने के method को discuss किया है |
Recent Posts
द्वितीय कोटि के अवकल समीकरण तथा विशिष्ट फलन क्या हैं differential equations of second order and special functions in hindi
अध्याय - द्वितीय कोटि के अवकल समीकरण तथा विशिष्ट फलन (Differential Equations of Second Order…
नियत वेग से गतिशील बिन्दुवत आवेश का विद्युत क्षेत्र ELECTRIC FIELD OF A POINT CHARGE MOVING WITH CONSTANT VELOCITY in hindi
ELECTRIC FIELD OF A POINT CHARGE MOVING WITH CONSTANT VELOCITY in hindi नियत वेग से…
four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं
चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…
Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा
आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…
pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए
युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…
THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा
देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…