Ask Question

Write a program that will accept input of two positive decimal integer values and output the prime factorizations of the input values. A sample run is below. User input is in boldface.

+3
Answers (1)
  1. 27 July, 12:37
    0
    C code given below

    Explanation:

    #include

    void factorize (int num) {

    int i = 2;

    printf ("The prime factorization of %d is ", num);

    while (num! = 0) {

    if (num % i = = 0) {

    printf ("%d", i);

    num / = i;

    if (num! = 1) {

    printf ("*");

    }

    else{

    printf ("./n");

    break;

    }

    }

    else{

    ++i;

    }

    }

    }

    int main () {

    int num;

    printf ("Give them to me one by one and I will do the factoring. / n");

    printf ("Number? ");

    scanf ("%d", &num);

    factorize (num);

    printf ("Number? ");

    scanf ("%d", &num);

    factorize (num);

    return 0;

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a program that will accept input of two positive decimal integer values and output the prime factorizations of the input values. A ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers