Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Armstrong numbers between two intervals

Write a program to print all the Armstrong numbers in the given range 

A to B(including A and B). An N-digit number is an Armstrong number if the number equals the sum of the Nth power of its digits.

Input

The first line has an integer 

A. The second line has an integer B.

Output

Print all Armstrong numbers separated by a space.
If there are no Armstrong numbers in the given range, print 

-1.

Explanation

For 

A = 150 and B = 200

For example, if we take number 153, the sum of the cube of digits 

1, 5, 3 is

 13 + 53 + 33 = 153.

So, the output should be 

153.

Sample Input 1
150
200
Sample Output 1
153
Sample Input 2
1
3
Sample Output 2
1 2 3

please provide correct output in sample output 2
Shaded Diamond

Given an integer value 

N as input, write a program to print a shaded diamond of 2*N -1 rows using an asterisk(*) character as shown below.

Note: There is a space after each asterisk (*) character.

Input

The first line of input is an integer 

N.

Explanation

In the given example 

N = 5. Therefore, the output should be

    * 
   * * 
  * * * 
 * * * * 
* * * * * 
 *     *
  *   *
   * *
    *
Sample Input 1
6
Sample Output 1
     * 
    * * 
   * * * 
  * * * * 
 * * * * * 
* * * * * * 
 *       *
  *     *
   *   *
    * *
     *
Sample Input 2
5
Sample Output 2
    * 
   * * 
  * * * 
 * * * * 
* * * * * 
 *     *
  *   *
   * *
    *

please provide correct output

WAP which displays a given character, n number of times, using a function. 

When the n value is not provided, it should print the given character 80 times. 

When both the character and n value is not provided, it should print ‘*’ character 80 times.

[Write the above program in two ways:- -using function overloading. -using default arguments.


Dumledore’s dining table can be thought of as an infinite row of seats with Dumbledore at one end. Each of Dumbledore’s guests represents a character of English alphabet (a to z).Dumbledore wants his guests to be seated such that the resulting string formed from the alphabets should be lexicographically smallest (See examples for reference).● Seats are allotted in sequential order, a guest who arrives later must be further from Dumbledore than a guest who arrives earlier.● An incoming guest must be assigned a seat, as soon as he arrives. He will take a seat.● Once a guest takes their seat, you can’t ask them to move to some other seat. Even if the seat in front of him is empty, they will stay at their occupied seat only.● But you can make a guest disappear using your spells, Dumbledore has allowed you to make at most ‘k’ of his guests disappear. He can handle ‘k’ guests not in the party but you can’t remove more than ‘k’ guests.


Create a program where you have to design your own Java console application about any valid problem that your application must solve. Your solution can include solving a business problem, a new idea or even a game. Your application must make use of concepts such as arrays, loops, inheritance, constructors and information hiding. Output must be shown in the form of a report using the console. Use Advanced arrays & Introduction to inheritance


# Method: Append a new price level to the levelsList

def addLevel(self):

try:

# Let the user enter a new float value and append it to the list

...

except:

# Print and error message if the user entered invalid input

...

# Method: Remove an existing price level from the levelsList

def removeLevel(self):

try:

# Let the user enter a new float value. If found in the list, remove it from the list

...

except:

# Print and error message if the user entered invalid input

...

# Method: Set levelsList to an empty list

def removeAllLevels(self):

# Set levelsList to an empty list

...

Replace ellipsis "..." with code


class PriceChecker():

# Constructor

def __init__(self):

self.levelsList = []

# Properties

@property

def levelsList(self):

return self.__levelsList

@levelsList.setter

def levelsList(self, newValue):

self.__levelsList = newValue

# Class Methods

# =============

# Method: Sort and Display the levelsList

def displayList(self):

print(chr(27) + "[2J") # Clear the screen

print("Price Levels In The List")

print("========================")

# Sort the list in reverse order

...

# Print the items in the list (Based on the above sort, numbers should appear from large to small.)

...


Instructions: Replace the ellipsis "..." with code



a. Using a while loop, write a program to calculate and print the sum of a given

number of squares. For example, if 5 is input, then the program will print 55, which

equals 1^2 + 2^2 + 3^2 + 4^2 + 5^2.

b. Reimplement this program using a for loop


 Write a program that prints the ASCII character codes for the upper case and lower-case

vowels. Hint: ASCII codes for A, E, I, O, U, a, e, i, o, u are required here


a. Using a while loop, write a program to calculate and print the sum of a given

number of squares. For example, if 5 is input, then the program will print 55, which

equals 12 + 22 + 32 + 42 + 52.

b. Reimplement this program using a for loop.


LATEST TUTORIALS
APPROVED BY CLIENTS