Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners CHECK WHICH NO IS GREATER IN 4 NO'S
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


AJAY CHAUDHARY
CHECK WHICH NO IS GREATER IN 4 NO'S
3 Answer(s)      3 years and 7 months ago
Posted in : Java Beginners


MAKE A PROGRAM TO CHECK WHICH NO. IS GREATER IN 4 NO'S IN JAVA ???


Advertisement
View Answers

April 14, 2011 at 11:59 AM


**class u
        {
                public static void main(String as[])
                  {
                      int a,b,c,d;
                      a=Integer.parseInt(as[0]);
                      b=Integer.parseInt(as[1]);
                      c=Integer.parseInt(as[2]);
                      d=Integer.parseInt(as[3]);
                  if(a>b)
                   {
                     if(a>c)
                        {
                          if(a>d)
                            {
                             System.out.println("a is greater");
                            }
                        else if(d>b)
                              {
                                 if(d>c)
                                  {
                                     System.out.println("d is greater");
                                  }
                                 else
                                  {
                                     System.out.println("c is greater");
                                  }
                              }
                            else
                                  {
                                     System.out.println("b is greater");
                                  }
                         }
                      else if(c>b)
                        {
                         if(c>d)
                           { 
                              System.out.println("c is greater");
                           }

                          else if(d>a)
                             {
                                if(d>b)
                                  {

                                    System.out.println("d is greater");
                                  }
                                else
                                 {
                                   System.out.println("c is greater");
                                 }
                             }
                            else
                             {
                                System.out.println("c is greater");
                             }
                        }
                       }
                      else if(b>c)
                         {
                             if(b>d)
                               {
                                 System.out.println("b is greater");
                               }
                             else if(d>b)
                                 {
                                   if(d>c)
                                     {
                                        System.out.println("d is greater");
                                      }
                                    else
                                    {
                                      System.out.println("b is greater");
                                    }
                                  }
                               else
                                 {
                                    System.out.println("b is greater");
                                 }
                         }
                       else if(c>d)
                          {
                           if(c>a)
                              {
                                 System.out.println("c is greater");
                              }
                           else
                             {
                                System.out.println("c is greater");
                             }
                           }
                         else
                           {
                              System.out.println("d is greater");
                           }
                      }

                }**


April 14, 2011 at 12:02 PM


import java.util.*;
class  FindLargest{
    public static void main(String[] args){
        int max = Integer.MIN_VALUE;
        System.out.println("Enter 4 numbers:");
        Scanner input=new Scanner(System.in);

        for(int i=1;i<=4;i++){
            int num=input.nextInt();
            if (num > max) {
                max = num;
               }
         }
        System.out.println("Largest Number is: "+max);
    }
}


April 14, 2011 at 12:15 PM


thanks for give to short coding for this question but my friend first anwser for clearly understand a if else condition(NESTED IF CONDITION)



Related Tutorials/Questions & Answers:
CHECK WHICH NO IS GREATER IN 4 NO'S
CHECK WHICH NO IS GREATER IN 4 NO'S  MAKE A PROGRAM TO CHECK WHICH NO. IS GREATER IN 4 NO'S IN JAVA ???   **class u...) { System.out.println("a is greater
Mysql Date Greater Then
Then' that illustrate you the example to extract the record which is greater than... which are greater than the given date.  Here in this example we... Mysql Date Greater Then     
Advertisements
check
updated"); will the above code check if the user has entered value for empcode
Hibernate Criteria Greater Than
Hibernate Criteria Greater Than The Hibernate Criteria Greater Than is used the fetch the value from the database which is Greater than the given value. gt() method of Restriction class is used to find greater value from a given value
Integrating spring 4 with hibernate 4
Integrating spring 4 with hibernate 4  Hi, How to integrate spring 4 with hibernate 4 backed with MySQL database? Thanks   Hi, Spring 4 framework provides the tools and apis for integrating the Hibernate 4. Check
Junit 4
Junit 4  Hello, I need someone to help me with the generic implementation of the toString method testing using Junit 4
Get the smallest double greater than the given value
and generate the new smallest double value which greater than the specified...Get the smallest double greater than the given value This section demonstrates you how to get the smallest double value greater than the given value. Java
Spring 4 features
Spring 4 features  Can anyone tell me the spring 4 features? I wan't to learn the new features of Spring 4 framework quickly? Thanks   Spring 4 framework is fully supporting JDK 8 and JEE 7 specification. It provides
check for errors
check for errors  How can I check for errors
Flex 4
Flex 4 The Flex 4 is open source framework for building Rich Internet (RI) Application. In this section we will see the features of Flex 4. The Flex 4 is open source framework which allows the developers to write applications which
Simple Example of Hibernate 4
. Share me the best example. Thanks   Hi, Check tutorial: Hibernate 4...Simple Example of Hibernate 4  Hi, As a new comer in the Hibernate... Hibernate 4.2 Tutorial Hibernate 4 Tutorial Hibernate beginner tutorial Thanks
password check
password check  how to check sighup passowrd and login password
Hibernate 4
Hibernate 4 Hibernate 4 is the latest version of Hibernate which was released in Jan, 2012. Hibernate 4 comes with many new features such as Multi-tenancy... features of Hibernate 4: Multi-tenancy support The introduction
check anagram
check anagram   compare two input is anagram or not but input contains million words
New Features in Hibernate 4
New Features in Hibernate 4  What are the new features in hibernate 4, which is recently released and available for development and deployment... in hibernate 4: Hibernate core now allows to multi-tenancies in three different ways
Criteria: Greater To Equal criteria Example
Criteria: Greater To Equal criteria Example In this Example, We will discuss... Restriction 'ge' and 'ne'. In This example we search for greater...: The resultant query generated by hibernate is as follows which produces
net beans 4
net beans 4  Write a JAVA program to read an initial two number x1... java.util.*; class RelativelyPrime { public static int check(int a, int b... return check(b, a % b); } public static void
check box left justification
check box left justification  how to make a check box left justification which is at right end? thanks in advance
xcode 4 create .ipa
xcode 4 create .ipa   Creating ad hoc for iphone distribution in XCode 4   You can edit scheme and assign different configuration...' button and select 'Edit scheme'. You'll see 'Archive' item which allow you
JDBC : Salary greater than average salary
JDBC : Salary greater than average salary In this section you will learn how to get records of employee having salary greater than the average salary. Salary greater than average salary : By using AVG(salary) function you can get
Create sessionfactory in Hibernate 4
Create sessionfactory in Hibernate 4  How to create sessionfactory in Hibernate 4? Thanks
Mysql Check
Mysql Check       Mysql Check is used to check the existence of table in the database. Understand with Example The Tutorial illustrate an example from 'Mysql Check
how to write greater than symbol in a file using java
how to write greater than symbol in a file using java  Hello I want to write < and > symbol in a file but its coming like > and < Please... the greater than and less than symbol is coming as & gt and & lt
type 4 jdbc driver
type 4 jdbc driver   i read in this site that type 4 jdbc driver is the fastest one so used it to connect with the database.......but not tried another drivers,....can u specifically answer me why type 4 is the fastest one
How to create spring 4 hibernate 4 maven example program?
How to create spring 4 hibernate 4 maven example program?  Hi, Tell me the easiest to create integrated spring 4 hibernate 4 example which is maven based and can create the war file from the command tool. Thanks
Hibernate 4 annotations tutorial
Hibernate 4 annotations tutorial  Hi, I am trying to find the best Hibernate 4 annotations tutorial. I think there is good tutorial on your site. Please tell me the url of Hibernate 4 annotations tutorial. Thanks   hi
type 4 drivers - JDBC
type 4 drivers  Hi! What is the syntax for Type - 4 drivers. give me any sample code. Thanks in advance..  Hi Friend, Please visit the following link: http://www.roseindia.net/jdbc/jdbc-driver-and-its
turbo C Question 4.
turbo C Question 4.  Possible to print the following (Using for Loops): 1. * ** 2.* * ** * * * *   specify the format properly
turbo C Question 4.
turbo C Question 4.  Possible to print the following (Using for Loops): 1. * ** 2.* * ** * * * *   specify the format properly
Hibernate 4 Example with Eclipse
Hibernate 4 Example with Eclipse   I am a beginner and want to know about the Hibernate 4 Example with Eclipse and how to install it. Can someone... in details about all your issues regarding Hibernate 4, Examples with Eclipse and its
Is buildSessionFactory() deprecated in hibernate 4?
Is buildSessionFactory() deprecated in hibernate 4?  Hi, I am trying to develop an application in Hibernate 4. I am using the Hibernate 4.3.0.final... sessions = cfg.buildSessionFactory(); But when I am using it in Hibernate 4 its
Advertisements
 

 

 

DMCA.com