How can we write an algorithm for show max and min from two
integer inputs ? without using if() , without any
functions ...



How can we write an algorithm for show max and min from two integer inputs ? without using if() , ..

Answer / rvd.srivastava@gmail.com

we can find it with da help of conditional operator(?:)
if a and b are input then
max=a>b?a:b
we can find maximum

Is This Answer Correct ?    10 Yes 0 No

Post New Answer

More Programming Code AllOther Interview Questions

i wrote from two tables (employee and department) 1.select * from employee,department; (it is cartesian product) but 2.select * from employee department; (?????????????????) by default it displays the employee table,what is the reason it is not taking department ??? mail @ mak2786@gmail.com Arunkumar

1 Answers  


Write a sql query to find n'th maximum in the database table.

3 Answers   Oracle,


import java.awt.*; import java.awt.event.*; public class Agency extends Frame implements ActionListener { Label l1,l2,l3,l4; Button b1; TextField t1,t2; String s1,s2,s3,s4; public static void main(String args[]) { new Agency().setVisible(true); } public Agency() { super("Gas Agency Package"); setSize(1280,800); setBackground(Color.lightGray); setLayout(null); // setLayout(new BorderLayout()); t1=new TextField(20); t1.setBounds(440,150,200,30); t1.setBackground(Color.white); t2=new TextField(20); t2.setBounds(440,180,200,30); t2.setBackground(Color.white); t2.setEchoChar('*'); l1=new Label("Gas Agency Package"); l1.setBounds(400,30,300,50); l1.setFont(new Font("TimesRoman",Font.BOLD,25)); l1.setAlignment(Label.CENTER); l2=new Label("Enter your ID and Passoword"); l2.setFont(new Font("TimesRoman",Font.BOLD,20)); l2.setBounds(270,80,300,50); l3=new Label("Enter ID"); l2.setFont(new Font ("TimesRoman",Font.BOLD,20)); l3.setBounds(270,150,120,50); l4=new Label("Enter Passoword"); l2.setFont(new Font ("TimesRoman",Font.BOLD,20)); l4.setBounds(270,180,140,50); add(l1); add(l2); add(l3); add(t1); add(l4); add(t2); b1=new Button("Login"); b1.setBackground(Color.white); b1.setBounds(400,280,100,70); b1.addActionListener(this); add(b1); } public void actionPerformed(ActionEvent e) { if(e.getSource()==b1) { s3="svce"; s4="svce"; s1=t1.getText(); s2=t2.getText(); if(s1.equals(s3) && s2.equals(s4)) { //System.out.println("password is correct"); MenuForm m= new MenuForm(); m.setVisible(true); //this.dispose(); } else { System.out.println("password not correct"); } this.dispose(); } } } plzzzzzzz xplain me this java code like why i m including this packages n the whole code plzzzzzz

0 Answers  


Write a Program to find the sum of digits of a given number until the sum becomes a single digit.

0 Answers   InterGraph,


utility used to obtain inform regarding the optimizes choice of access strategy for SQL stmts

1 Answers  






Dear sirs, Hi, I would like to inform you that I want to perform a project using MLP neural network to recognize binary images containing three types of geometric shapes such as squares,rectangels and circles. Furthermore,each image includes only one geometric type. The output of network would be: '1' if the network detects square shape. '2' if the network detects rectangle shape. '3' if the network detects circle shape. '4' if none of these shapes detected. Would you please send me a matlab source code for this project? Your prompt reply would be so appreciated. regards,

0 Answers   Microsoft,


i am doing my final year project about programming use verilog ,i am new about it so got problem,i want to record the readings of a waveform every 2us use the verilog code ,every ten readings i need to add them together after that i need to compare this series of number to get which one is the biggest , right now i don't know how to use code to store the readings every 2us on a waveform ,pls help me thanks a lot .

0 Answers  


Write a Program to find the number of words in a sentence.

0 Answers   InterGraph,


You have been asked to install a servlet engine (tomcat, glassfish, etc.) for a companies servlets. Assuming the company has an existing web/DBMS server (which may or may not be on the same server), explain in detail how would you implement the development project and a deployment solution.

0 Answers  


Beautiful is for 012345678 9 and a code for similar word containing the same alphabets

0 Answers  


Hi, I want the code to fetch multiple rows in REXX using RLX and CURSOR. Can anyone help me?

0 Answers  


Write a Program to truncate a given floating point value (e.g.16.25=16).

0 Answers   InterGraph,


Categories