This should work for you:
#include <stdio.h>
int main() {
int rows, columns;
int rowCount, columnCount, count = 0;
printf("Please enter rows and columns:
>");
scanf("%d %d", &rows, &columns);
for(rowCount = 0; rowCount < rows;
rowCount++) {
for(columnCount = 1; columnCount <=
columns; columnCount++) {
if(count % 2 == 0)
printf("%4d " ,
(columnCount+(rowCount*columns)));
else
printf("%4d " ,
((rowCount+1)*columns)columnCount+1);
}
count++;
printf("
");
}
return 0;
}
Input:
5 5
Output:
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
21 22 23 24 25

Related to : Program to code zigzag matrix

python  how to compute correlationmatrix with nans in datamatrix 
You can convert all nan values to zeros using np.nan_to_num() and then
proceed further. Demo:
>>> data
array([[ 5.1, 3.5, 1.4, 0.2],
[ 4.9, 3. , nan, 0.2],
[ 4.7, 3.2, 1.3, nan],
[ nan, 3.1, 1.5, 0.2]])
>>> np.cov(data.T)
array([[ nan, nan, nan, nan],
[ nan, 0.04666667, nan, nan],

Eigen sparse matrix multiplications seem to compute full matrix 
Basically, the document is sightly confusing for me at least.
the way to do it is simply:
SpMat mat_3 = mat_1 * mat_2
No dense matrix is created along the way.
Eigen rocks!

matrix inside matrix when multiplying symbolic matrices 
The problem seems to be the K = C2^(16/57). Taking the root of a
matrix is not trivial and solutions don't always exist. That's why
MATLAB cannot resolve this expression. Try for example:
A = syms('A',[3,3]); % create 3x3 symbolic matrix
B = A^(1/3); % calculate the 3rd root of A
The result will be
ans = matrix([[a1_1, a1_2, a1_3], [a2_1, a2_2, a2_3], [a3_1, a3_2,
a3_3]])^(1/3)

Filling up a matrix with computed values of another matrix 
Assuming that the block of columns are based on the first two
characters, i.e. A1, A2, we can split this into different blocks by
using substr to extract the first two characters from the column names
and use this as index to split. Then, we can either use apply with
range and diff to get the result or use pmax and pmin.
indx < substr(colnames(df), 1,2)
If the grouping is not based on t

C: Return even number in array program by using pointers, why does my program crush after printing the result 
for(i = 0; i <= sizeof(test); i++){
printf("%d
", *test[i] );
}
sizeof(test) isn't the number of elements in the array test, it's
sizeof(int*) which is 8 (bytes), assuming you're on a 64bit system.
It's returning the size of a pointer to a memory address, not the
actual length of the array. So your loop goes outside the bounds of
the array which probably causes your problem.
Al

