## Posted By

ozkriff on 09/15/08

# diff

/ Published in: C

starting the programm...

mas1: control output: 12 7 53 13 66 45

finding max... debag info(current max): (0,0) 12 (0,1) 12 (1,0) 53 (1,1) 53 (2,0) 66 (2,1) 66

max is 66

finding min... debag info(current min): (0,0)12 (0,1)7 (1,0)7 (1,1)7 (2,0)7 (2,1)7

min is 7

finding diff...

diff is 59 Answer: max= 66 min=7 diff = 59

(program exited with code: 0)

`#include <stdio.h> int main(){	printf("\nstarting the programm...\n\n");	int max, min, diff, i, j, mas1[3][2]={		{12,7},		{53,13},		{66,45}};	//control output	printf("\nmas1: control output:\n");	for (i=0;i<3;i++)	{		for (j=0;j<2;j++)			printf("%d\t",mas1[i][j]);		printf("\n");	}	//finding max	printf("\nfinding max...");	printf("\ndebag info(current max):\n");	max=mas1[0][0]; 	for (i=0;i<3;i++)	{		for (j=0;j<2;j++)		{			max=(mas1[i][j]>max)?mas1[i][j]:max;			printf("(%d,%d) %d   ",i,j,max);		}	printf("\n");	}			printf("\nmax is %d\n",max);	//finding min	printf("\nfinding min...");	printf("\ndebag info(current min):\n");	min=mas1[0][0]; 	for (i=0;i<3;i++)	{		for (j=0;j<2;j++)		{			min=(mas1[i][j]<min)?mas1[i][j]:min;			printf("(%d,%d)%d   ",i,j,min);		}	printf("\n");	}			printf("\nmin is %d\n",min);	//finding diff	printf("\nfinding diff...\n");	diff=max-min;	printf("\ndiff is %d",diff);	//Answer	printf("\n\nAnswer: max= %d\t min=%d\t diff = %d",max,min,diff);	return 0;}`