1. sayfa
#include <stdio.h> void fun1(int a[5][5]) /*aim is finding the smallest one */ { int x=0; int y=0; int temp; for(x=0;x<5;x++){ printf("smallest in this array is: %d , coordinates [%d][%d]\n",a[x][y],x,y); for(y=0;y<5;y++){ temp=a[x][y]; if(a[x][y]<temp) a[x][y]=temp;} } } int main() { int a[5][5]= { {8,3,12,6,90}, {12,34,62,24,21}, {88,43,71,14,65}, {26,90,33,44,68}, {17,48,56,33,72} }; fun1(a); return 0; }
#include <stdio.h> void fun1(int a[5][5]) /*aim is finding the smallest one */ { int x=0; int y=0; int temp; int coor1,coor2; // Koordinatlar için for(x=0;x<5;x++) { temp=a[x][0]; //temp'i dizinin ilk rakamına atıyoruz //Koordinat x,0 şeklinde oluyor ilk başta coor1=x; coor2=0; { for(y=0;y<5;y++){ //sayı tempten küçükse sayıyı tempe atıyoruz.koordinatları da coor1 ve coor2 sayılarına atıyoruz. if(a[x][y]<temp) { temp=a[x][y]; coor1=x; coor2=y; } } printf("smallest in this array is: %d , coordinates [%d][%d]\n",temp,coor1,coor2);} } } int main() { int a[5][5]= { {8,3,12,6,90}, {12,34,62,24,21}, {88,43,71,14,65}, {26,90,33,44,68}, {17,48,56,33,72} }; fun1(a); return 0; }
bu arraydeki her 5linin en küçük elemanını bulmak istiorm. baya uğraştım ama yapamadım. bi el atar mısınız lütfen