The second Question is very tuff for me

The second Question is very tuff for me

You are to choose between two procedures, both of which compute the mini-mum value in an array of integers. One procedure returns the smallest integer if its array argument is empty. The other requires a nonempty array. Which procedure should you choose and why?
View Answers

February 15, 2010 at 5:02 PM

Hi Friend,

Try the following:

public class Small{
public static void main(String[] args) {

int []num={100,20,152,24,456,651,258,35};
int min = num[0];
for (int i=1; i<num.length; i++) {
if (num[i]< min) {
min = num[i];
}
}
System.out.println("Smallest Number: "+min);
}
}

Thanks









Related Tutorials/Questions & Answers:
The second Question is very tuff for me - Java Beginners
The second Question is very tuff for me   You are to choose between two procedures, both of which compute the mini-mum value in an array of integers. One procedure returns the smallest integer if its array argument is empty
help me to solve this question...
help me to solve this question...  Given below is a class definition for Book. Type and compile the class, and answer the following questions: class Book { String title; //bookâ??s title double price; //bookâ??s
Advertisements
pls help me with this question
pls help me with this question  how to write a program in C++ using encapsulation,polymorphism,inheritance and abstraction?(all these concepts should come in a single program
Ple help me its very urgent
Ple help me its very urgent  Hi.. I have one string 1)'2,3,4' i want do like this '2','3','4' ple help me very urgent
help me to solve this question
help me to solve this question  Write a program that inputs a series of integers into an array. The numbers are in the range 0 to 100. Calculate and display : a) The Largest number b) The Smallest Number c)The sum of the numbers
plz help me for this question
plz help me for this question  Apply simplex procedure to solve the L.P.P. maximize z = 3x1 + 4x2 subject to 5x1 + 4x2 â?¤ 200; 3x1 + 5x2 â?¤ 150; 5x1 + 4x2 â?¥ 100; 8x1 + 4x2 â?­â?¥ 80, x1 â?¥ 0, x2 â?¥ 0
Please help me... its very urgent
Please help me... its very urgent  Please send me a java code to check whether INNODB is installed in mysql... If it is there, then we need to calculate the number of disks used by mysql
help me to solve this question
help me to solve this question   A user needs to key in data into system in order to save data into array. The data are: a. Lecturer ID, Lecturer name, School, course code, course name, session, semester A user can edit the data
Answer me ASAP, Thanks, very important
Answer me ASAP, Thanks, very important  Sir, how to fix this problem in mysql i have an error of "Too many connections" message from Mysql server,, ASAP please...Thanks in Advance
the question make me so blur
the question make me so blur  write java code that read an integer and determine and print whether it is odd or even.(Hint: use the remainder operator.An even number is a multiple of 2. Any multiple of 2 leaves a remainder of 0
its very urgent please help me
its very urgent please help me  how can i retrieve all images from ms access database and display in jsp pages
Plz give me code for this question
Plz give me code for this question  Program to find depth of the file in a directory and list all files those are having more number of parent directories
please give me an idea to develop a program for this question?
please give me an idea to develop a program for this question?  How to enter a text or number from keyboard without using InputStreamReader method in java
it is a linux question is there anyone who can help me out with it?
it is a linux question is there anyone who can help me out with it?  ... the first two numbers together and then call a second script that accepts two parameters; the sum of the first two numbers and the third number. Your second
interview question plz help me and thers
interview question plz help me and thers  A college is good if it satisfies the following conditions: 1.Its number of students is greater than 1000. 2.If the name ends wih a character 'e', then it should not start with character
very urgent : Iam unable to code this program plz help me - RMI
very urgent : Iam unable to code this program plz help me  Write a Multi-user chat server and client.  Hi friend, Chat server is a standlone application that is made up the combination of two-application, server
please help me to solve this question about array
please help me to solve this question about array  write a program thatt stores vowels (a,e,i,o and u)in an array. Ask the user to enter any character. The program should ignore the case of that character (uppercase or lowercase
Plz help me with this Question - Java Beginners
Plz help me with this Question  this is java code ------------------------- Consider the following code: int [ ] a = [1, 2, 3]; Object o ="123"; String t = "12"; String w = t + "3"; Boolean b = o.equals (a); Boolean b2
please give me a java program for the following question
please give me a java program for the following question  Write a java program that displays multiple frames : Step 1: Design a frame with three buttons: ?Fruit?, ?Bird? and ?Animal? Step 2: On clicking ?Fruit? button
please any one can help me to write a code for this question?
please any one can help me to write a code for this question?  1) Copy one file content to other? 2) Count the number of words in a file
how to output text from comboBox from first frame to textField on the second frame? please help me.. thank you in advance..
how to output text from comboBox from first frame to textField on the second frame? please help me.. thank you in advance..  how to output text from comboBox from first frame to textField on the second frame? please help me
please any one can help me to write a code for this question?
please any one can help me to write a code for this question?  Q 1) In a class first day 25 students are joined. After two days that total students will increased to 60. We can develop a program by using ArrayList concept
Clear Question plz et me know immediately - Java Beginners
Clear Question plz et me know immediately   Hi Deepak your application is good,pls modify this application and let me know My problem is that, Steps: 1:- A form have three 3 button delete,insert,edit. 2
i have a problem to do this question...pls help me..
i have a problem to do this question...pls help me..  Write a program that prompts the user to input an integer and the output the number with the digits reversed. For example if the input is 12345, the output should be 54321
sir i,have a assignment for these question plz help me sir - JavaMail
sir i,have a assignment for these question plz help me sir   1.Design a Java interface for ADT Stack. Develop two different classes that implement this interface, one using array and the other using linked-list. Provide
please help me to answers this question about C++.....huuhuhuhu
please help me to answers this question about C++.....huuhuhuhu  1) Write a full program for the bubble sort algorithm. User is required to enter specific input numbers and the program will be able to sort the given numbers
please help me to answers this question about C++.....huuhuhuhu
please help me to answers this question about C++.....huuhuhuhu  1) Write a full program for the bubble sort algorithm. User is required to enter specific input numbers and the program will be able to sort the given numbers
hi... pls give me the example of java coding fo following question
hi... pls give me the example of java coding fo following question  example java coding that reads in the radius and length of cylinder and computes volume. formula: Area = radius * radius * PI Volume = area * length
hi.. please give me a java coding for the following question
hi.. please give me a java coding for the following question  Write a program that prompts the user to enter the number of students and each studentâ??s name and score, and finally displays the name of the students
hi.. please give me a java coding for the following question
hi.. please give me a java coding for the following question  Write a program that displays the following table (note that 1 mile is 1.609 kilometers). Miles Kilometers
hi.. please give me a java coding for the following question
hi.. please give me a java coding for the following question  Write a program that reads in investment amount, annual interest rate, and number of years, and displays the future investment value using the following formula
hi.. please give me a java coding for the following question
hi.. please give me a java coding for the following question  Suppose that the tuition for a university is RM10,000 this year and increases 5% every year. Write a program that computes the tuition in ten years and the total cost
hi.. please give me a java coding for the following question
hi.. please give me a java coding for the following question  Write a function called ChangeToNext that take in an uppercase character parameter ch. The function returns the next uppercase character if ch is between 'A' and 'Y
hi... pls give me the example of java coding fo following question
hi... pls give me the example of java coding fo following question  Write a java program that reads the following information and prints a payroll statement: Employeeâ??s name (e.g: Sam) Number of hours worked in a week (e.g: 10
hi... pls give me the example of java coding for following question
hi... pls give me the example of java coding for following question   Write a program that computes loan payments. The loan can be a car loan, a student loan, or a home mortgage loan. The program lets the user enter the interest
hi.. please give me a java coding for the following question
hi.. please give me a java coding for the following question  Body Mass Index(BMI) is a measure of health on weight. It can be calculated by taking your weight in kilograms and dividing by the square of your height in meters
hi.. please give me a java coding for the following question
hi.. please give me a java coding for the following question  Write a class that contains the following two methods: /* converts from inches to centimeters */ Public static double inchToCentimeter(double in) /* converts from
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
hi,i'am new to Jsp.Can some one please let me know an answer for this question?
hi,i'am new to Jsp.Can some one please let me know an answer for this question?  how do we upload an xml file and validate them against WIPO DTD
question
question  Dear sir i had some typing mistake at previous question so its my humble request to let me know the steps to start the tomcat6 under the tomcat directory
Perl and CGI Miscellaneous Very short delay Tutorial
If you want to emulate very short delay in your program, with duration less than 1 second, you should use select function (if your system supports.... Example: To emulate a short delay for 0.33 of the second you can write
sir i,have a another assignment for these question plz help me sir - JavaMail
sir i,have a another assignment for these question plz help me sir  1. Design classes for Currency, Rupee, and Dollar. Write a program... to both. plz help me sir
Second Section
 Second SectionPrev Appendix A. First Appendix Next     Second Section The Sun Certified Business Component Developer (SCBCD) for the Java 2 Platform, Enterprise
Second level cache
Second level cache  Hi, I have been asked one question which I have no idea about. It's like I have enabled second level caching and the data has... and how do I refresh( reload) my second level cache. Please advise, and ignore my
question
question  Sir, Please send me Java Swing source code for video streaming , it's very urgent
question
question  good afternoon sir, please send me a simple Jsp or Java code to display a calendar with Indian public holidays,current date and time.It is very urgent,please consider and me as soon as possible
I really need help with this assignment question Please help me out Please
I really need help with this assignment question Please help me out Please  * Description* You are hired to develop a laptop inventory information system for Sheridan College in order to keep track of the information about
question
question  please give me the relevant modules and details to start java coding for "Deriving Concept-based User Profiles from Search Engine Logs" it's very urgent
question
question  Gud morning sir, I have asked u some question regarding jsp in saturaday for that i didnot find any answere in which u send me the some of the links.U have asked me the specify some details. There is a entity name

Ads