Answer to Question #22343 in C++ for Gert

Question #22343
That is my code, and i need to make the FOURTH COLUMN SUM up all its elements, like makes random elemts 5,21,4,1 and i need to programm to do 5+21+4+1=31 and display on the screen



#include <stdio.h>
#include <time.h>
#include <stdlib.h>

#define RIDU 4
#define VEERGE 7
#define MAX 150
#define MIN 10

int main (void)


{



int maatriks [RIDU] [VEERGE];
int i,j;
int nTotal = 0;

srand(time(NULL));



for(i=0; i<RIDU; i++)

{
for(j=0; j<VEERGE; j++)
{

maatriks[i][j]=rand()%(MAX-MIN)+MIN;
}
{

}


printf("Fourth column and its sum\n");

for(i=0; i<RIDU; i++)
{
for(j=0; j<VEERGE; j++)
{
(nTotal += maatriks[i][3]);
if (j<1) printf("%4d", maatriks[i][3]);
}
printf("\n");
}




return 0;
}
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS