java programing

java programing

write a program to input a number or find & print the highest digit.

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
java programing
java programing  reverse a multidigit number using recursive definition
Advertisements
java programing
java programing  write a program to input a number or find & print the highest digit
java programing
java programing  write a program to input a number or find & print the highest digit. example:-2639 than print 9
Java Programing
Java Programing  I)WAP to print following series: 1) 1 2 3 2 3 4 5 4 3 4 5 6 7 6 5 4 2) (5!/x)+(10!/xx)+(15!/xx*x)+.....n terms. II)Write a menudriven program to perform the following as long as user
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
java IO programing
java IO programing  how Java source file is used as input the program will echo lines
beginning java programing
beginning java programing  Hi. I am trying to write a piece of code that not allow a duplicate item to be added to the list (and allow for either upper or lowercase names). But the same name keep adding onto the list. Can someone
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
programing
programing  Using Java, Design a simple interface that can capture information of your choice with the following controls; Labels, Text Fields, Checkbox, Radio buttons and command buttons. You may have to use the following files
socket programing in servlet
socket programing in servlet  give me a example to write socket programing in servlet
programing
programing
programing
programing
programing
programing
programing
programing
programing
cnc programing course
cnc programing course  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: cnc programing... the topic "cnc programing course". Also tell me which is the good
cnc programing classes near me
cnc programing classes near me  Hi, I am beginner in Data Science... programing classes near me Try to provide me good examples or tutorials links so that I can learn the topic "cnc programing classes near me". Also tell
help with substring in c programing
help with substring in c programing  Hi I could not found programming in C in the "select category" so I am posting my question in java section. Please help with substring function,prompt the user for two strings and display
C++ programing
c programing
c programing
socket programing
fingerprint recognition in Java language.
fingerprint recognition in Java language.   I want a programing source code for fingerprint recognition in Java language
Threading in Java
career in java
career in java  I have just completed my BE(IT). I am interested to make my career/profession in java. i know core java, Servlet, JSP . What to study more? How to study j2ee programing? which ebook i should download or purchase

Ads