Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
888 B
3
Indexable
Never
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int	board[10][10];
	
	/* Matrise rastgele değer ata */
	for(int i = 0; i < 10; i++)
	{
		for(int j = 0; j < 10; j++)
			board[i][j] = rand() % 100;
	}

	/* Matrisi Yazdır */
	for(int i = 0; i < 10; i++)
	{
		for(int j = 0; j < 10; j++)
			printf("%d\t", board[i][j]);
		printf("\n");
	}

	printf("\n\n");
	
	for(int i = 0; i < 10; i++)
	{
		for(int j = i + 1; j < 10; j++)
		{
			if(board[i][9 - i] < board[j][9 - j])
			{
				int temp = board[i][9 - i];
				board[i][9 - i] = board[j][9 - j];
				board[j][9 - j] = temp;
			}
		}
	}


	/*
	for(int  i= 0; i < 10; i++)
	{
		int	temp = board[i][i];
		board[i][i] = board[i][9 - i];
		board[i][9 - i] = temp;
	}
	*/

	for(int i = 0; i < 10; i++)
	{
		for(int j = 0; j < 10; j++)
			printf("%d\t", board[i][j]);
		printf("\n");
	}
}
Leave a Comment