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
kirza4 [7]
4 years ago
6

Write a program that will accept input of two positive decimal integer values and output the prime factorizations of the input v

alues. A sample run is below. User input is in boldface. So you want two numbers factored. Give them to me one by one and I will do the factoring.
A. The prime factorization of 12 is:________.
B. The prime factorization of 1050 is:________.
Computers and Technology
1 answer:
Sidana [21]4 years ago
3 0

Answer:

# include <stdio.h>

# include "math.h"

void primeFactors(int n)

{

printf("The prime factorization of n is: ");

int flag=0;

while (n%2 == 0)

{

if ( flag == 1 ) printf("*");

else flag=1;

printf("%d", 2);

n = n/2;

}

int i = 3;

for (i; i <= sqrt(n); i = i+2)  

{

while (n%i == 0)

{

if(flag==1) printf("*");

else flag=1;

printf("%d", i);

n = n/i;

}

}

if (n > 2){

if(flag==1) printf("*");

else flag=1;

printf ("%d", n);

}

}

int main()

{

int n = 0;

printf("Enter Number: ");

scanf("%i",&n);

primeFactors(n);

printf("\n");

return 0;  

}

Explanation:

  • Create a function to print all prime factors of a given number n
  • Print the number of 2s that divide n  and n must be odd at this point. So we can skip one element.
  • While i divides n, print i and divide n
  • Apply condition to handle the case when n is a prime number.
You might be interested in
Every brand of computer has its own binary language, called
Kaylis [27]
Machine language.

Hope this helps
6 0
3 years ago
Why was unicode invented?
lilavasa [31]
Unicode is a universal computing standard to represent texts in most writing systems. It was invented to store most of the world's characters. It started during 1987. Joe Becker from Xerox was the one who made a proposal for Unicode.
6 0
3 years ago
Read 2 more answers
When does technology become assistive technology?
deff fn [24]
Technology becomes assistive technology C. WHEN SOMEONE WITH A DISABILITY OR LIMITATION USES IT TO HELP HIM OR HER DO SOMETHING.

Assistive technology is defined as any technological item, equipment, software or product system that is used to assist individuals with disabilities to increase, improve, and maintain their functional capabilities.
6 0
3 years ago
Read 2 more answers
One method of encoding messages is known as the "expanding square code". this method encodes message by placing the character of
mars1129 [50]
Wow!! that is ALOT of info,I dont think i could help with this one Umders 699 maybe someone else can sorry that i couldn`t help :)
4 0
4 years ago
Managers can use __ software to discuss financial performance with the help of slides and charts
Natali5045456 [20]

Answer:

presentation

Explanation:

Software like Google Slides and Microsoft Powerpoint can be utilized to present financial performances through the use of slides and charts.

6 0
3 years ago
Other questions:
  • Why is wearable technology important?
    12·1 answer
  • Your friend sees an error message during Windows startup about a corrupted bootmgr file. He has another computer with a matching
    12·1 answer
  • How do I connect my CSS file and HTML page together? it's just not wanting to work for me. I have 3 other HTML pages that have t
    12·1 answer
  • What is the top folder of the file tree called
    5·2 answers
  • Which of the following about if statement is true? A. The condition is a Boolean expression B. A Boolean expression is something
    15·1 answer
  • str1=”Good” str2=”Evening” Does the concatenation of the above two strings give back a new string or does it concatenate on the
    14·1 answer
  • SATCOM in the Ku- and Ka- bands, as well as EHF systems are adversely affected by rain (the higher the frequency, the greater th
    14·1 answer
  • Grandma Ester normally gives you hugs for your birthday - one for every year old you are. When you turned 15, she squished you w
    8·1 answer
  • I can't get my screen to scroll down when answering questions in brainly. Help?
    13·1 answer
  • What development first helped people shape their communities through<br> informed decisions?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!