Armstrong was one of the greatest scientist.The Indian Science Council decided to design an Memorable Coin with many numbers printed on it in memory of Great Armstrong.But ISC is looking for a criteria to decide which numbers need to be printed on the Prestigious Gold Coin.There was a suggestion given by the Members of Indian Science Council.If the sum of the cube of each number is again equal to the number then that particular number can be added into the coin.Kindly help the Indian Science Council to implement the task by writing a simple programming logic.Constraints:1≤number≤1000Input format:Only line of input has a single integer representing the number. Output format:In the only line of output print as “Part of Memorable Coin” or “Not a Part of Memorable Coin” based on the condition.
Question
Armstrong was one of the greatest scientist.The Indian Science Council decided to design an Memorable Coin with many numbers printed on it in memory of Great Armstrong.But ISC is looking for a criteria to decide which numbers need to be printed on the Prestigious Gold Coin.There was a suggestion given by the Members of Indian Science Council.If the sum of the cube of each number is again equal to the number then that particular number can be added into the coin.Kindly help the Indian Science Council to implement the task by writing a simple programming logic.Constraints:1≤number≤1000Input format:Only line of input has a single integer representing the number. Output format:In the only line of output print as “Part of Memorable Coin” or “Not a Part of Memorable Coin” based on the condition.
Solution
This problem can be solved using Python programming language. Here is a simple Python program that checks if a number is an Armstrong number or not.
# Function to check if a number is an Armstrong number
def is_armstrong(num):
# Initialize sum
sum = 0
# Find the sum of the cube of each digit
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** 3
temp //= 10
# If the sum is equal to the number, then it is an Armstrong number
if num == sum:
return True
else:
return False
# Input number
num = int(input("Enter a number: "))
# Check if the number is an Armstrong number
if is_armstrong(num):
print("Part of Memorable Coin")
else:
print("Not a Part of Memorable Coin")
This program works by taking an input number and checking if it is an Armstrong number. An Armstrong number is a number that is equal to the sum of the cubes of its digits. For example, 153 is an Armstrong number because 1^3 + 5^3 + 3^3 = 153. The program uses a while loop to find the sum of the cubes of the digits of the number, and then checks if this sum is equal to the original number. If it is, the program prints "Part of Memorable Coin", otherwise it prints "Not a Part of Memorable Coin".
Similar Questions
Write a C program, which reads in the amount and prints the number of notes/coins of each denomination. Start with the highest denomination of Indian currency. 23761 x 20001 x 2001 x 1001 x 501 x 201 x 51 x 1
Single File Programming QuestionProblem StatementPranav is playing a coin game with his friends. Create a simple program to assist Pranav in converting a given amount of cash into the minimum number of coins. Prompt Pranav to input the cash amount and utilize assignment operators to calculate and display the minimum number of coins needed for denominations of 100, 50, 10, 5, 2, and 1. Assume these denominations as coins with values of 100, 50, 10, 5, 2, and 1, respectively.Note:Give the input greater than 100.Input format :The input is a single integer c representing the amount of cash.Output format :The output displays the minimum number of rupee notes for denominations of 100, 50, 10, 5, 2, and 1.Refer to the sample output for the formatting specifications.Code constraints :In the given scenario, the test cases fall under the following constraints:100 ≤ c ≤ 10000Do not use any looping structures.Sample test cases :Input 1 :100Output 1 :1Input 2 :589Output 2 :12Input 3 :10000Output 3 :100Code Size : 1024 kbNote :The program will be evaluated only after the “Submit Code” is clicked.Extra spaces and new line characters in the program output will result in the failure of the test case.
Write a C program to determine if a given integer is an Armstrong number or not. An Armstrong number (also known as a narcissistic number or pluperfect digital invariant) is a number that is equal to the sum of its own digits raised to the power of the number of digits. For example, 153 is an Armstrong number because 13+53+33=15313+53+33=153.Design a function called isArmstrong that takes an integer num as input and returns 1 if num is an Armstrong number, and 0 otherwise. Your program should prompt the user to enter an integer, call the isArmstrong function to check if it is an Armstrong number, and display an appropriate message indicating whether the entered number is an Armstrong number or not.inputEnter a number: 153output153 is an Armstrong number.
Pranav is playing a coin game with his friends. Create a simple program to assist Pranav in converting a given amount of cash into the minimum number of coins. Prompt Pranav to input the cash amount and utilize assignment operators to calculate and display the minimum number of coins needed for denominations of 100, 50, 10, 5, 2, and 1. Assume these denominations as coins with values of 100, 50, 10, 5, 2, and 1, respectively
Mary is a cashier at a store and needs a program to help her break down amounts of money into specific denominations. Depending on the customer's preference, she needs to provide either the number of notes or coins needed to make up a given amount. Write a program that takes the amount of money and the preferred mode as input, and outputs the number of each denomination required to make up that amount.Company Tags: Adobe, InfosysInput format :The first line of input contains a double value, representing the amount of money.The second line contains a string, either 'notes' or 'coins', indicating the preferred mode of denomination.Output format :If the mode is 'notes', print the number of 500, 100, 50, and 10 denomination notes required, each on a new line.If the mode is 'coins', print the number of 25, 10, 5, and 1 cent coins required, each on a new line.If the mode is invalid, print "Invalid mode"Refer to the sample output formatting specifications.Code constraints :10.0 ≤ amount ≤ 5000.0Sample test cases :Input 1 :35.60coinsOutput 1 :25 cents: 14210 cents: 15 cents: 01 cent: 0Input 2 :2250.29notesOutput 2 :500: 4100: 250: 110: 0Input 3 :3000.50CurrencyOutput 3 :Invalid mode
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.