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
¿Cuántos megabytes (MB) de capacidad tiene una memoria USB de 16 GB? el que me diga por que le doy una coronita
-Dominant- [34]

Answer:

16,384MB

Explanation:

1GB contiene 1024MB de capacidad. Si multiplicamos esto por 16 veemos que 16GB es igual a 16,384MB. Este seria el espacio exacto, aunque se dice que 1GB tiene 1000MB. Eso es por que la palabra Giga significa x1000 y el numero binario entero mas cercano a 1000 es 1024. Entonces los ingenieros usan este numero para representar la cantidad de espacio en un GB que tambien seria 2^{10}

7 0
2 years ago
Anybody want to help me figure out how to put this on a resumè
Svet_ta [14]

Answer:

OMG IM LIKE BLUSHING AS DARK AS A TOMATO RIGHT NOW

5 0
3 years ago
What stdio.h input function would be used to get input from the user by the keyboard? Write the code to obtain the voltage drop
torisob [31]

Answer:

scanf() function is used to get a input from keyboard.This function is in the stdio.h library.To use this function we must include the stdio.h library first in the code. Then only we can use the scanf() function in any code.printf() function is used to print anything .this function is from stdio.h library.

Code to read voltage drop across the register.

#include <stdio.h>

// main function

int main(void) {

// variable

double vr1;

printf("Enter voltage drop:");

// read  voltage drop from user

scanf("%lf",&vr1);

// print voltage drop

printf("voltage drop is:%0.2lf",vr1);

return 0;

}

Output:

Enter voltage drop:200.4                                                                                                  

voltage drop is:200.40

8 0
3 years ago
The measure of error in keyboardist is called?​
Dimas [21]
Jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
8 0
3 years ago
An enterprise DBMS is automatically capable of serving as a mobile DBMS. There are no special issues raised by mobility. True Fa
pishuonlain [190]

Answer:

The answer is True.

Explanation:

The enterprise DBMS can also be used with mobile DBMS.

Enterprise DMBS is the latest version of DBMS which is used in organizations and enterprises to handle a huge amount of Data.

Enterprise Database Management System is mainly designed to do large work simultaneously. It can handle multiple queries simultaneously.  

Multiple users (about 100-10,000 users) can access data at the same time and even they can manipulate simultaneously.

The features of Enterprise DBMS is to work efficiently, multi processing, fast, accurately, and handling huge burden of data.

4 0
3 years ago
Other questions:
  • We have to calculate the percentage of marks obtained in three subjects (each out of 100) by student A and in four subjects (eac
    11·1 answer
  • How can volunteering to help plan a fundraiser for your team or club be a way to develop your strengths?
    10·2 answers
  • What are the basic tools for coding HTML manually?
    10·2 answers
  • Describe an ergonomic consideration for your body while working for long periods in front of a monitor or computer screen?
    14·1 answer
  • Create an array to hold the rainfall values. Create a 2nd parallel array (as a constant) to hold the abbreviated names of the mo
    9·1 answer
  • Users who are connecting to an NLB cluster have been complaining that after using the site for a few minutes they are prompted t
    15·1 answer
  • please help me to do this computer homework I beg you all please help me to get the answers please its important please ​
    12·1 answer
  • The process of redefining the functionality of a built-in operator, such as , -, and *, to operate on programmer-defined objects
    14·1 answer
  • If you want to join all of the rows in the first table of a SELECT statement with just the matched rows in a second table, you u
    10·1 answer
  • SOMEONE HELP ME!!!!!
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!