1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
salantis [7]
2 years ago
7

I want to solve this question in C program, Please.

Computers and Technology
1 answer:
inn [45]2 years ago
4 0

Answer:

#include <stdio.h>

#include <math.h>

int is_armstrong(int n) {

int cubedSum = 0;

int r = n;

while (r) {

         cubedSum += (int)pow(r % 10, 3);

          r = r / 10;

}

return cubedSum == n;

}

int stack_count(int n) {

int sum = 0;

while (n) {

         sum += n % 10;

         n = n / 10;

}

return sum;

}

int is_magical(int n) {

while (n > 9) {  

 n = stack_count(n);

 printf("%d ", n);

}

return n == 1;

}

int main()

{

int input = 0;

int isMagical, isArmstrong;

while (true) {

 printf("Enter a number: ");

 scanf_s("%d", &input, sizeof(int));

 if (input == -1) break;

 isArmstrong = is_armstrong(input);

 isMagical = is_magical(input);  

 if (isArmstrong && isMagical) {

  printf("%d is both an armstrong and a magical number.\n", input);

 } else if (isArmstrong) {

  printf("%d is an armstrong number\n", input);

 } else if (isMagical) {

  printf("%d is a magical number\n", input);

 } else {

  printf("%d is neither an armstrong or a magical number.\n", input);

 }

}

}

Explanation:

Here is a starting point. What's the definition of a magical number?

You might be interested in
_________ media must be downloaded in its entirety to the user's computer before it can be heard or seen
gladu [14]

Answer:

Downloadable

Explanation:

Cloud computing can be defined as a type of computing that requires shared computing resources such as cloud storage (data storage), servers, computer power, and software over the internet rather than local servers and hard drives.

Generally, cloud computing offers individuals and businesses a fast, effective and efficient way of providing services.

In Computer science, a downloadable media must first be downloaded in its entirety and saved to a user's computer before it can be played, heard or seen.

For example, for an end user to listen to a song hosted on a particular website, he or she must first of all download the song in its entirety and have saved on a computer system before it can be seen, played and listened to. Also, other downloadable media such as videos, animations, texts, etc., must be downloaded before they can be accessed or used by an end user.

4 0
3 years ago
When a program terminates because a thrown exception is not handled, the program:
castortr0y [4]

Answer:

Option (e)

Explanation:

Option (e) is the answer. It indicates the exception thrown and displays it. It also indicates the place where the exception was thrown ( at what line of the code the exception was thrown )

Option (a) is false as the program which was terminated because of an exception which was not handled doesn't starts automatically.

Option (b) is false as it doesn't opens a dialogue box about running the program another time or anything. It just terminates because of the unhandled exception.

Option (c) is false as it doesn't saves all the output to a disk file called the "runStackTrace.txt".

Option (d) is false as it doesn't open a dialogue box. The program terminates because of the unhandled exception.

4 0
3 years ago
Photographs, illustrations, and videos are increasingly created an and viewed in digital formats. True or False​
lutik1710 [3]

Answer:

I think it's True but I don't know sorry if I'm wrong

6 0
2 years ago
Read 2 more answers
By default, Outlook displays messages in the Content pane grouped by the
goldfiish [28.3K]

Answer:

By default, Outlook orders messages in the Content pane grouped by dates the messages were received and sorted with the oldest message at the top of the list.

Explanation:

8 0
2 years ago
A form of brainstorming that serves as a visual aid to thinking laterally, helps explore a problem (usually by stating the probl
ELEN [110]

Answer:

The answer is BRAINSTORMING

Explanation:

<em>A visual aid to thinking laterally and exploring a problem, usually by stating the problem in the center  of the page and radiating outward spokes for components of the problem. Each component can then be considered separately with its own spokes, so that each point , thought, or comment is recorded.</em>

7 0
3 years ago
Other questions:
  • A retail company assigns a $5000 store bonus if monthly sales are $100,000 or more. Additionally, if their sales exceed 125% or
    5·1 answer
  • What is the best way to locate where my C program gets into an infinite loop
    5·1 answer
  • n a​ poll, 6767​% of Internet users are more careful about personal information when using a public​ Wi-Fi hotspot. What is the
    11·1 answer
  • You can insert video by clicking video drop-down menu on the ______ tab.
    15·1 answer
  • Can someone help me plz
    13·2 answers
  • A client is
    15·2 answers
  • Which of the following statements is/are correct? a. At the network layer, entitlement can map identity and/or attributes to fun
    8·1 answer
  • Explain why it is important that the device registration is the last thing that is done in the initialization routine of a devic
    10·1 answer
  • True or false: if you are adding your own css sheet, make sure your css file comes before the bootstrap css file.
    7·1 answer
  • The final step in the object-oriented design (ood) process consists of developing the?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!