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



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

Have Programming Question? Ask it here!
 
 
 


AJAY CHAUDHARY
CHECK WHICH NO IS GREATER IN 4 NO'S
3 Answer(s)      3 years and 5 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
check for errors
check for errors  How can I check for errors
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
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
check anagram
check anagram   compare two input is anagram or not but input contains million words
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
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
check box left justification
check box left justification  how to make a check box left justification which is at right end? thanks in advance
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
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
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
Create sessionfactory in Hibernate 4
Create sessionfactory in Hibernate 4  How to create sessionfactory in Hibernate 4? Thanks
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
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... in flex 4, while in 3 it worked correctly. Even in: arrTaxa=new ArrayCollection
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
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: Flex 4 delivers wide variety of new and enhanced features
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
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... you to check whether your PHP web page has been connected with MySQL server
Features of Spring 4
) is the major release which is fully supporting the Java 8. Spring 4 can... 4 framework supports latest annotation driven programming model which helps... is introduced in Spring 4 which can be used to filter the beans using some
click on check box
click on check box  I create a check box in HTML and when i click on my check box relative information in page store in database
Check even or odd number.
Check even or odd number.  How to check given number is even or odd..."); } } } Description: num is variable which hold the inputted number. BufferReader is used for inputting number. Even numbers are those numbers, which are divisible
Spring 4 MVC Login form Example with source code
is the code of the pom.xml which which contains the spring 4 dependencies. <... form example. Check the next tutorial which will teach you how to use...Spring 4 MVC Login form Example: Learn how to make a Login form in Spring MVC
how to insert check box
how to insert check box   how to insert check box into jtable row in swing
To check a palindrome number?
To check a palindrome number?  program to check a number is palindrome or not using recursion?(wihout converting to string
Help for Check availability of user
Help for Check availability of user  I need the code for check availability of users in the database before login.I placed a button for Check Availability.Can it be done with this or ajax should be used
xCode 4 add new framework
xCode 4 add new framework  Hi, How to add new framework in Xcode 4 based application? Thanks
how to enable nszombie in xcode 4
how to enable nszombie in xcode 4  how to enable nszombie in xcode 4
upgrade mysql 4 5 cpanel
upgrade mysql 4 5 cpanel  upgrade mysql 4 5 cpanel
What is CHECK Constraint?
What is CHECK Constraint?  What is CHECK Constraint?   Hi, The CHECK constraint is used to limit the value range that can be placed in a column.The SQL CHECK constraint ensures that all values in a column satisfy
How to use the latest buildSessionFactory in Hibernate 4?
to check out the- Hibernate 4 tutorials Learn Hibernate 4.3 framework I hope...How to use the latest buildSessionFactory in Hibernate 4?  Hello, I... buildSessionFactory in Hibernate 4?   Hello Friend, buildSessionFactory has
check box in jsp
check box in jsp  hey guys i am working on a web based project using jsp. In my project 1 am having 9 check boxes in 3 rows in the same form. I want to select 1 check box from each row and also i want to avoid many check box
check null exception java
check null exception java  check null exception java - How to check the null exception on Java?   The null pointer exception in java occurs... this error. The only way to handle this error is validation. You need to check
 

 

 

DMCA.com