हेलो स्टूडेंट्स, इस पोस्ट में हम आज Write a function in C++ to find and display the sum of each row and each column of a 2-dimensional array के बारे में पढ़ेंगे | इंटरनेट में C++ भाषा के नोट्स हिंदी में बहुत कम उपलब्ध है, लेकिन हम आपके लिए यह हिंदी में डिटेल्स नोट्स लाये है, जिससे आपको यह टॉपिक बहुत अच्छे से समझ आ जायेगा |
Write a function in C++ to find and display the sum of each row and each column of a 2-dimensional (2D) array of type float. Use the array and its size as parameters with float as its return type.
// assuming that maximum rows and cols are 10, 10 respectively
void RowColSum( float A[10][10], int r, int c)
{
int i, i; float RS[10], CS[10];
// find row sum
for(i=0; i<r; i++)
{
RS[i]=0;
for(j=0; j<c; j++)
RS[i] + = A[i][j];
}
//find colum sum
for(i=0; i<c; j++)
{
CS[i]=0;
for(i=0; i<r; i++)
CS[i]+=A[illil;
}
//display 2-d array with rowsum and colsum
for(i=0; i<r; i++)
{
for(j=0; j<c; i++)
cout< <A[i][i]<< 't';
cout< <RS[i]<<endl;
}
for(j=0; i<c; j++)
cout<<CS[i]< < 't';
cout<<endl;
}
Also read : C++ Program to exchange the positions of strings stored in array.
Table of Contents
अपने दोस्तों के साथ share कीजिये.
Related
हम आशा करते है कि यह Write a function in C++ to find and display the sum of each row and each column of a 2-dimensional array के हिंदी में नोट्स आपकी स्टडी में उपयोगी साबित हुए होंगे | अगर आप लोगो को इससे रिलेटेड कोई भी किसी भी प्रकार का डॉउट हो तो कमेंट बॉक्स में कमेंट करके पूंछ सकते है | आप इन्हे अपने Classmates & Friends के साथ शेयर करे |