Last active
May 8, 2018 13:56
-
-
Save bahacan19/cd9cef6fd40926476ad5364ba8f51bc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.c | |
// C_playground | |
// | |
// Created by Baha Can Aydın on 08/05/2018. | |
// Copyright © 2018 Baha Can Aydın. All rights reserved. | |
// | |
#include <stdio.h> | |
int main(int argc, const char * argv[]) { | |
int matrix[4][4] = | |
{ | |
{1, 5, 6, 7}, | |
{4, 4, 8, 0}, | |
{2, 3, 4, 5}, | |
{1, 2, 9, 1} | |
}; | |
int raw = 0; | |
int num_rows = sizeof(matrix) / sizeof(matrix[0]);// matrisin satır sayısı | |
int num_cols = sizeof(matrix[0]) / sizeof(matrix[0][0]);// matrisin sütun sayısı | |
int kose = num_rows - 1; // 2 ile çarpacağım ilk elemanın satırdaki yeri (3). Sıfırıncı elemandan başladığıma göre, (0,3) pozisyonunda bulunan eleman. | |
do { | |
int column = 0; | |
do{ | |
int eleman = matrix[raw][column]; | |
if (kose == column) { | |
eleman = eleman * 2; | |
} | |
if (column == num_cols - 1) {//satır sonu | |
printf(" %d \n",eleman); | |
kose--; | |
} | |
else{ | |
printf(" %d ",eleman); | |
} | |
column++; | |
} while (column < num_cols); | |
raw++; | |
}while (raw < num_rows); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment