To find minimum number in single dimensional array
public class arraydemominsingle
{
public static int min(int []x)
{
int min=x[0];
for(int i=1;i
{
if(x[i]
{
min=x[i];
}
}
return min;
}
public static void main(String[] args)
{
System.out.println("Minimum value is"+min(new int[]{45,33,56,32}));
No comments:
Post a Comment