DescendingDigits - S int d = kb.nextInt(); i if(d...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.Scanner; i public class DescendingDigits { p public static boolean isDescending(int desc){ p int t = desc; double d; t = t/10; d = t; d while(d/10 > 1){ if(t%10 > (t/10)%10){ return false; } } return true; } public static void main(String[] args){ p Scanner kb = new Scanner(System.in); S System.out.println("Enter an integer greater than or equal to 0");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: S int d = kb.nextInt(); i if(d < 0){ System.out.println("Integer must be greater than or equal to 0"); } else if(isDescending(d)){ System.out.println("The digits of " + d + " are in descending order"); } else{ System.out.println("The digits of " + d + " are not in descending order"); } } }...
View Full Document

This note was uploaded on 11/15/2010 for the course CSCI 01209 taught by Professor Storm during the Fall '10 term at University of Georgia Athens.

Ask a homework question - tutors are online