1 2 3
0 4 5
0 0 6
public class arraydemotriangleBmin {
static void triangleBmin(int x[][])
{
int i,j,min=0;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{min=x[0][0];
if(i<=j)
{
if(x[i][j]
min=x[i][j];
}
}
}
}
System.out.println("The Min Value in triangle B is:"+ min);
}
public static void main(String[] args)
{
triangleBmin(new int[][]{{1,2,3},{4,5,6},{7,8,9}});
}
}
No comments:
Post a Comment