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 ???

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... the Query to extract the name of the  employee which are greater than... 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
ModuleNotFoundError: No module named 'greater_context'
ModuleNotFoundError: No module named 'greater_context'  Hi, My... named 'greater_context' How to remove the ModuleNotFoundError: No module named 'greater_context' error? Thanks   Hi, In your python
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
How to check if a string exits in a string script in Java script?
How to check if a string exits in a string script in Java script? Java... is an instance based with first class and making it a programming language which... computer science. Here is the video tutorial of "How to check if a string exists
ModuleNotFoundError: No module named 'Greater-than-equal-or-less-Library'
ModuleNotFoundError: No module named 'Greater-than-equal-or-less-Library' ...: ModuleNotFoundError: No module named 'Greater-than-equal-or-less-Library' How to remove the ModuleNotFoundError: No module named 'Greater-than-equal-or-less-Library
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
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
Version of which>which dependency
List of Version of which>which dependency
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
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
check for errors
check for errors  How can I check for errors
which tags work on which browsers
which tags work on which browsers  Is there a site that shows which tags work on which browsers
password check
password check  how to check sighup passowrd and login password
check anagram
check anagram   compare two input is anagram or not but input contains million words
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
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
Greater Kailash M-Block Market Delhi
Greater Kailash M-Block Market Delhi The market at the Greater Kailash M-block..., in the phase I of the Greater Kailash region, Delhi, this market has a huge share in the economy exchange of Delhi. The M-Block market complex Greater Kailash New
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
What are the 4 types of AI?
are the 4 types of AI? Try to provide me good examples or tutorials links so that I can learn the topic "What are the 4 types of AI?". Also tell me which...What are the 4 types of AI?  Hi, I am beginner in Data Science
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
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
bootstrap 4 pull-right
check following thread to view running example code: Bootstrap 4 button align...bootstrap 4 pull-right  Hi, I am trying to align a button with the .pull-right class but don't know why its not working in Bootstrap 4. I just
bootstrap 4 pull-right
check following thread to view running example code: Bootstrap 4 button align...bootstrap 4 pull-right  Hi, I am trying to align a button with the .pull-right class but don't know why its not working in Bootstrap 4. I just
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
Criteria: Greater To Equal criteria for Date type
Criteria: Greater To Equal criteria for Date type In this Example, We... Restriction 'ge'. In This example we search for greater to equal ...: The resultant query generated by hibernate is as follows which produces
Create sessionfactory in Hibernate 4
Create sessionfactory in Hibernate 4  How to create sessionfactory in Hibernate 4? Thanks
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
Installing Bootstrap 4 with bower
Installing Bootstrap 4 with bower  HI, I am using Bower and want to install the Bootstrap 4 with bower? What are the steps for Installing Bootstrap 4 with bower? Thanks   Hi, First of all you should have bower tool
Installing Bootstrap 4 with bower
Installing Bootstrap 4 with bower  HI, I am using Bower and want to install the Bootstrap 4 with bower? What are the steps for Installing Bootstrap 4 with bower? Thanks   Hi, First of all you should have bower tool
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
Installing Bootstrap 4 with bower
Installing Bootstrap 4 with bower  HI, I am using Bower and want to install the Bootstrap 4 with bower? What are the steps for Installing Bootstrap 4 with bower? Thanks   Hi, First of all you should have bower tool
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
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
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
Referencing components in flex 4
Referencing components in flex 4  I used to create flex 3 applications using canvas as main components. In this moment I am creating flex 4... a static class in flex 4, while in 3 it worked correctly. Even in: arrTaxa=new
Check PHP MySQL Connectivity
Check PHP MySQL Connectivity: The first step of any kind of connectivity is to check whether the connectivity has been established or not. To check... of code will help you to check whether your PHP web page has been connected
Mysql Check
Mysql Check       Mysql Check is used to check the existence of table in the database... 'Mysql Check'.To understand this example we use CHECK TABLE keyword that show
Spring 4 MVC Login form Example with source code
which contains the spring 4 dependencies.ADS_TO_REPLACE_4 <project xmlns.... Download the source code of the Spring 4 MVC login form example. Check... the login credential against database?.ADS_TO_REPLACE_14 Check more Spring 4
Flex 4 Features
Flex 4 Features Flex released its new version Flex 4 with huge changes... application builder tool named ?Flash Builder? which was formerly known as ?Flex... Flex 4 features:ADS_TO_REPLACE_1 Flex 4 delivers wide variety of new
Maven Repository/Dependency: which | which
Maven Repository/Dependency of Group ID which and Artifact ID which. Latest version of which:which dependencies. # Version Release Date You can read more at: Maven Tutorials
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
Artifacts of which
List of Artifacts of which maven depenency
check box left justification
check box left justification  how to make a check box left justification which is at right end? thanks in advance

Ads