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]
3 years ago
7

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

Computers and Technology
1 answer:
inn [45]3 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
CSc 2720 - Data Structures: Assignment 1 [100 points] How to Submit: Turn the .java file in Folder Assignment 1 in iCollege no l
gavmur [86]
Hehehwkwjhdhebfhshshwjbrbr
5 0
3 years ago
Defining table _______ creates links between tables that identify a correspondence of fields from one table to another.
Alexxx [7]

Answer:

B

Explanation:

3 0
4 years ago
Why do you think the issue of evolution become a cause celebre in the 1920s
vovikov84 [41]
Religious people are fearful morons oh and human progress but this is an opinionated question so you can't get this wrong
6 0
3 years ago
What is the classification of the Gartner company?
Strike441 [17]

Answer:

It Is Multimedia

Explanation:

Trust Me

3 0
3 years ago
A computer cooled by a fan contains eight PCBs, each dissipating 10 W power. The cooling air is supplied by a 25-W fan mounted a
Kay [80]

Given Information:  

Qin = 8*10 = 80 W

Win = 25 W

Temperature = T2-T1 = 10°C

Required Information:  

(a) flow rate of the air = m = ?

(b) fraction of the temperature rise of air = f = ?

Answer:  

(a) flow rate of the air m = 0.01044 kg/s

(b) fraction of the temperature rise of air f = 23.8 %

Solution:

(a) The flow rate of the air that fan needs to deliver can be found by

m = Q_{in}  + W_{in} /C_{p} (T_{2} -T_{1} )

Where the value of specific heat of air is 1005 j/kg.C

m = (80 + 25)/1005*10

m = 0.01044 kg/s

(b) fraction of the temperature rise of air due to fan

ΔT = Q/mCp

ΔT = 25/0.01044*1005

ΔT = 2.38°C

So the fan causes a temperature rise of 2.38°C

f = ΔT/T2-T1

f = 2.38/10

f = 0.238 = 23.8 %

8 0
3 years ago
Other questions:
  • Web and mobile applications allow users to be actively engaged in an online activity
    5·2 answers
  • What should you do before cleaning the top of a storage battery and rinsing it with fresh water?
    12·1 answer
  • "______" is a wireless local network that uses high frequency radio signals to transmit an Internet signal from a wireless route
    9·1 answer
  • Universal Containers wants line items to be organized into pre-defined groups on the output document. The name of these pre-defi
    6·1 answer
  • Computer-aided manufacturing (CAM) offers which possible benefits?
    15·2 answers
  • The variable most_recent_novel is associated with a dictionary that maps the names of novelists to their most recently published
    12·1 answer
  • What is the deck of a suspension bridge called​
    15·1 answer
  • Task queues, which allow for asynchronous performance, are an important part of modern processing architectures. Information abo
    13·1 answer
  • Which statement best describes network security?
    7·1 answer
  • What virtual, logically defined device operates at the data link layer to pass frames between nodes?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!