1.Divisors flow chart using modulo operator (%) to print out all the divisors of a user entered...

80.2K

Verified Solution

Question

Programming

1.Divisors

flow chart using modulo operator (%) to print out allthe divisors of a user entered number. Your program should promptthe user to enter a positive number or 0 to end. Using a loopvariable that starts at 1, your program should print out all thedivisors of the entered number plus the number of printed divisorsand their sum.

For example:
This program identifies and displays divisors of a givennumber.
Developed as an IPC144 project.

Enter a positive number. Enter 0 to end: 15
1 3 5 15
4 divisors
sum of divisors: 24

Enter a positive number. Enter 0 to end: 36
1 2 3 4 6 9 12 18 36
9 divisors
sum of divisors: 91

Enter a positive number. Enter 0 to end: 43
1 43
2 divisors
sum of divisors: 44
Enter a positive number. Enter 0 to end: 0
Thanks and bye!

  1. Divisor counter

Using what you did in part 1,to develop a functioncalled
unsigned divisorCount (unsingned num)

That gets an integer number as an input parameter andreturns the number of divisors of that number. For example, if yousend 15 to the function, it will return 4 as 15 has 4 divisors: 1,3, 5, 15
The function will return 2 for 17 because 17 only has twodivisors


3.Prime number

Using the function you developed in part 2, writea
int isPrime(unsigned num)

That gets a number as a paremeter and returns 1 if thenumber is prome and returns 0 if the number is notprome.

Use this function to write a code that gets a numberfrom the user and prints all the prime numbers smaller and equal tothat number

A sample run of your code should look like:

Please enter a positive integer number (0 to end): 12Primes before 12 are: 2 3 5 7 11

5 Prime numbers smaller than 12

Please enter a positive integer number (0 to end): 7Factors of 7 are: 2 3 5 7

4 prime numbers smaller than 7

Please enter a positive integer number (0 to end):0

Thanks and have a good day!

Hint: This question is divide to three-parteach of the parts is individual and the answer for each of the partwill need to link together with a flowchart and c code

Answer & Explanation Solved by verified expert
4.1 Ratings (501 Votes)
Flow chart to find    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students