Notice
Recent Posts
Recent Comments
Creative Code
sumMatrix.c( 다차원배열의 원소의 합) 본문
#include <stdio.h>
int main(void)
{
int matrix[3][4] = {{1,2,3,4},{5,6,7,8},{9,10,11,12}};
// int matrix[3][4] = {1,2,3,4,5,6,7,8,9,10,11,12};
int total = 0;
for (int i = 0; i<3; i++){
for (int j = 0; j<4; j++){
total += matrix[i][j];
}
}
printf("sum : %d\n",total);
return 0;
}
'C Programming' 카테고리의 다른 글
pointer2.c(포인터) (0) | 2023.08.02 |
---|---|
pointer.c(포인터) (1) | 2023.08.02 |
lotto.c (로또 번호 생성) (0) | 2023.08.02 |
baseball.c(숫자 야구게임) (0) | 2023.08.02 |
dice.c(주사위 값 srand함수) (0) | 2023.08.02 |