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
How would our lives be different without computers at home?
Yuri [45]

Answer:

It would be so difficult to spend a life without computers. We would not be aware of technology or what things are being discovered. We could get information by newspaper, television, radio or some other medium but on computers.

Explanation:

Thanks for the points have a good day <3

8 0
2 years ago
For Official Use Only (FOUO) and Controlled Unclassified Information (CUI) may include all of the following except: (circle one)
quester [9]

Answer

A. Secret Information

Explanation

For Official Use only is a security information term for designation applied by most governments. In the United States, it is used by the department of defense to handle orders for controlled Unclassified Information (CUI), and is strictly unclassified. The main purpose of this program is to eliminate inefficient and misleading patch work across agencies in the department of defense.


7 0
3 years ago
Read 2 more answers
What career is likely to have the highest salary
erma4kov [3.2K]

Here are the top ten highest paying jobs relating to technology and computers.


Software Architect - $116,267*

Data Scientist - $109,399.

Devops Engineer - $106,045.

Software Engineer - $98,304.

Java Developer - $98,304.

Mobile Developer - $96,133.

Frontend Developer - $92,133.

Software Developer - $87,185.


4 0
3 years ago
Which of the following does Moore's law predict?
Korolek [52]

Answer:

Hi!

The correct answer is the a.

Explanation:

The Moore's law is an a empirical law that Gordon Moore predicted doing some observations about how the density of the transistors on a integrated circuit was increasing over time.

For example, this law state that if you have an integrated circuit with: 1000 transistors in 1980 then in 1981 and six months later you will have the same integrated circuit with 2000 transistors, and so on..

  • Jan 1980: 1000 transistors.
  • Jul 1981: 2000 transistors.
  • Jan 1983: 4000 transistors.
  • Jul 1984: 8000 transistors.

And that's the reason because its cost will fall too.

7 0
3 years ago
Your friends credit scores are 560, 675, 710, 590, and 640. Your credit score is 680. What is the difference between the average
Wittaler [7]

Answer:

560+675+710+590+640=3175/5=635

so your credit score is 45 credits better than the average of your friends

Explanation:

3 0
3 years ago
Other questions:
  • You have a user who takes his laptop home every day after work. When he's working in the office, the laptop must get an IP addre
    13·1 answer
  • Some IOS commands store passwords as clear text, but you can then encrypt the passwords with the service password-encryption glo
    10·1 answer
  • Which of the following is a principle that can improve the efficiency of I/O?
    7·2 answers
  • Which of the following will increase the level of security for personal and confidential information on a mobile device if the d
    14·1 answer
  • When Creating a FPS game what basic rules would you add?
    12·1 answer
  • Select the three reasons that the gaming industry is set to grow.
    12·2 answers
  • What are two examples of events in the Outlook Calendar?
    10·2 answers
  • Ses
    15·1 answer
  • Which of the following statements is false?
    9·1 answer
  • Which of the following is NOT a long-term storage device?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!