Question: programing

Ads

 
 
 

Share on Google+Share on Google+

sandeep parashar
programing
1 Answer(s)      5 years and 4 months ago
Posted in : Java Server Faces Questions

write a program to input a number find & print the middle digit if no of digit are odd other wise print the average of middle two digit.

Ads
View Answers

December 28, 2011 at 11:54 AM


import java.util.*;

class InputNumber 
{
    public static void main(String[] args) 
    {
        Scanner input=new Scanner(System.in);
        System.out.print("Enter number: ");
        int num=input.nextInt();
        int largest=0;
        while( num > 0 ){
        int digit = num % 10;
        num = num / 10;
        if (digit > largest) 
        largest = digit;
        }
        System.out.println("Highest digit is: "+largest);
        }
    }

Ads









Related Tutorials/Questions & Answers:
Java programing
Java programing   need help wrting this Write a program that has an array of 5 Strings, and determines which ones are palindromes (letter-case does not matter). thanks
socket programing in servlet
socket programing in servlet  give me a example to write socket programing in servlet
Advertisements
programing question
programing question  how do i use loops(for,while) to add components in java   Hi Friend, The below code might help you. import java.awt.*; import javax.swing.*; class TextFieldArray extends JFrame{ JLabel l[]=new
Programing Help - Java Beginners
Programing Help  how to design a filebrowser in java "witout using Swing
SOCKET PROGRAMING IN THE JAVA FOR NETWORKING CONCEPT
SOCKET PROGRAMING IN THE JAVA FOR NETWORKING CONCEPT  I WANT TO KNOW ABOUT THE JAVA SOCKET PROGRAMING FROM BASIC LEVEL AND HOW CAN I WORK ON IT I KNOW THE JAVA PROGRAMING.SO PLEASE HELP ME HOW CAN I DO SOCKET PROGRAMING
Java programing help
Java programing help  Can you help me create this program? Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign
javascript programing error - JSP-Servlet
javascript programing error  hi deepak i m using explorer to run javascript program in this there is no option to check error will u plz tell me the way to check error in explorer as we can check with mozila
java programing problem - Java Beginners
java programing problem  Create a class named Movie that can be used with your video rental business. The Movie class should track the Motion picture Association of America rating , ID Number, and movie title with appropriate
guys,, need help,, in java programing,, arrays
guys,, need help,, in java programing,, arrays  create a program where you will input 10 numbers and arrange it in ascending way using arrays
Tutorials   
Java Spring Hibernate Struts Training i have an ques. of advanced java commandlink tag in primefaces needs onclick effect how can i run ASP.Net Server from netbeans IDE? java code for cursor java vertual machine launcher error; cannot access jarfiles JSF Tutorial render in input typetext java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener After authentication and connection establishment, Upload a zipfile by chunks in java JSF CONNECTION WITH MICROSOFT ACCESS Download Current Web Page As PDF java servlet dropdown list in jsf panelGrid header do the following how to make drop down list in JSF & fetch data Item from database help me please doubt regarding JSF Creating Dynamic Tree How to upload zip file from android to server programmatically????? jsf application war file not running in my jboss 6.0 on linux 5.5 Business analysis servlet servlet exception in thread main while running servlet How to get browser time zone? JAVA Socket Programming excel report fro jsp mysql Redirect to same jsp page on successful login jsf f:parm value dynamical settings jsf f:parm value dynamical settings RMI Program in netbeans pagination in jsf pagination jsf pagination How create csv format in jsf ? need JSP Code. Arrays, loops and string handling unique value renderer JSF 1.2 online tutorial JSF code JSP jps Multicast under UDP(client server application) How to rectify "Bad version number in .class file" exception in Eclipse about avl tree and hashing project on avl tree and hashing How to navigate from one jsf to another in eclipse how to focus on the new window opened from JSF ? Editing UI components using managed bean

Ads

 
Advertisement null

Ads