Write a Java program to check whether a given number is an ugly number. In number...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Java program to check whether a given number is an ugly number. In number system, ugly numbers are positive numbers whose only prime factors are 2, 3 or 5. First 10 ugly numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12. By convention, 1 is included. SAMPLE INPUT: (i) 235 (ii) 120 (iii) 15 OUTPUT: It is not an ugly number. It is an ugly number. It is an ugly number. Write a Java program to check whether a given number is an ugly number. In number system, ugly numbers are positive numbers whose only prime factors are 2, 3 or 5. First 10 ugly numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12. By convention, 1 is included. SAMPLE INPUT: (i) 235 (ii) 120 (iii) 15 OUTPUT: It is not an ugly number. It is an ugly number. It is an ugly number.
Expert Answer:
Answer rating: 100% (QA)
Heres a Java program that checks whether a given number is an ugly n... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
re Regular Languages and Finite Automata (a) Let L be the set of all strings over the alphabet {a, b} that end in a and do not contain the substring bb. Describe a deterministic finite automaton...
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
11) log, 16 4X220 4 ky 13) log, 8+log, (1-4x)=log, 63 15) log, 3x-log, 5=4 12) Evaluate 2 log, 7776-log, 729 14) log, (x-6)+log, (x-5)=1 loge (x-6)+ log 6 (x-5' 16) log 9+ logx = 4
-
For the linear-strain element shown in Figure P8-6, determine the strains (x, (y, and (xy. Evaluate these strains at the centroid of the element; then evaluate the stresses (x, (y, and (xy at the...
-
For a recent year, McDonald's company-owned restaurants had the following sales and expenses (in millions): Assume that the variable costs consist of food and packaging, payroll, and 40% of the...
-
Journal entries for both buyer and seller periodic inventory system Non-GST version The following transactions relate to the businesses of C. Wynn and C. Vale. Both businesses use a periodic...
-
Much to your surprise, you were selected to appear on the TV show The Price Is Right. As a result of your prowess in identifying how many rolls of toilet paper a typical American family keeps on...
-
a) The trial balance of Nyaguthie enterprises prepared as at 30th April, 2016 failed to balance. The difference was posted to a suspense account. On investigation, the following errors were revealed....
-
Find the angle of intersection of surfaces xy 3 = 3x+z 3x - y + 2z = 1 at (1,-1,2) are
-
The inventory of XYZ Company on November 30, 2014 shows 2500 units at 12,5 per unit. Revenue from sales for December totals 64,000 (= 3,200 units at 20 per unit). The following purchases were made...
-
Why did the William Wordsworth feel lonely at the beginning in the poet: The Daffodils?
-
Write a C++ program that takes resistance of three resistors (in Ohms) and a the connection code 'S' or 'P' for series and parallel connections. If the connection code is S then the program should...
-
Relationships reduce the quantity of data stored in a database by minimizing data duplication across multiple tables. Group of answer choices True False
-
A privately held company ABB wants to be listed on a stock exchange. The company expects to earn a net profit of $50 million next year. In order to estimate its equity value, management decided to...
-
Prove or disprove the conjectures: (a) {x|3y R:x= y 2y} = R. (b) If A, B, C are sets, then (AN B)-C (A-C) N (B-C)
-
Uniform electric field in Figure a uniform electric field is directed out of the page within a circular region of radius R = 3.00 cm. The magnitude of the electric field is given by E = (4.50 x 10-3...
-
Create two linked hash sets {"George", "Jim", "John", "Blake", "Kevin", "Michael"} and {"George", "Katie", "Kevin", "Michelle", "Ryan"} and find their union, difference, and intersection. (You can...
-
Add the following method in the BST class that returns an iterator for traversing the elements in a BST in preorder. /** Returns an iterator for traversing the elements in preorder */...
-
Write a method that returns the sum of all the elements in a specified column in a matrix using the following header:public static double?sumColumn(double[][] m,?int?columnIndex)Write a test program...
-
What are the main phases of a design review?
-
Classify these Bluetooth layers using the OSI model: a. baseband; b. L2CAP; c. RFCOMM.
-
Use the power state machine of Fig. 8.12 to determine the energy used in these use cases: a. idle 1 s; receive 10 ms; idle 0.1 s; transmit 5 s; b. sleep 1 min; receive 50 ms; idle 0.1 s; receive 100...
Study smarter with the SolutionInn App