e) What does each function do? Hint: Write a simple description for each of the user-defined functions. void print_stars(): void option_list() void divisors(int n) Example: This function takes one...


e) What does each function do?<br>Hint: Write a simple description for each of the user-defined functions.<br>void print_stars():<br>void option_list()<br>void divisors(int n)<br>Example:<br>This function takes one argument of type int and prints its divisors on the screen, including, 1 and itself.<br>summation(int s)<br>int factorial (int n)<br>

Extracted text: e) What does each function do? Hint: Write a simple description for each of the user-defined functions. void print_stars(): void option_list() void divisors(int n) Example: This function takes one argument of type int and prints its divisors on the screen, including, 1 and itself. summation(int s) int factorial (int n)
#include<stdio.h><br>Y void print_stars();<br>* void option_list();<br>*<br>void divisors(int n);<br>• int summation(int s);<br>int factorial (int n):<br>int main(void) {<br>int number, result, op ;<br>char flag:<br>11<br>printf(
"); scanf "%d", &number ); ir dol 10 option_list(); scanf("%d" , &op); switch(op) { case 1: 19 divisors(number); Y. break; case 2: YY result = summation(number); printf("Summation = %d\n", result); break; YO case 3: result = factorial(number): printf("Factorial = %d\n", result); break; YY YA default: printf("\NERROR: %d is unrecognized option!!! \n", op); print_stars(); printf("Do you want to check another function? (Y/N)> "): scanf(" %c" , &flag); } while (flag == "Y" || flag == 'y'); rv return 0; . void option_list(){ print_stars(); printf("1: Find the divisors \n"); printf("2: Compute the summuation\n"); printf("3: Compute the factorial \n"); print_stars(); printf("Please enter your choice: "): EA void print stars() int i; for(i = 1;i<= 25;="" i++)="" printf("");="" 01="" or="" or="" printf("\n");="" 00="" 01="" void="" divisors(int="" n)="" {="" int="" i;="" printf("divisors="" of="" %d="" are\n",n);="" for(i="1;ic=n;i++)" if(n%i="0)" printf("="" %d",i);="" 09="" 1.="" printf("\n");="" 10="" lint="" factorial="" (int="" n){="" 11="" int="" i,="" fact="1;" for="" (i="2;"><= n;="" i++)="" fact="" *="" i;="" 14="" return="" fact;="" vi="" int="" summation(int="" s){="" if="" (s="=" 0)="" vy="" return="" 0;="" else="" yo="" return="" s+="" summation(s-1);="" "/="">
Extracted text: #include Y void print_stars(); * void option_list(); * void divisors(int n); • int summation(int s); int factorial (int n): int main(void) { int number, result, op ; char flag: 11 printf("Enter an integer number > "); scanf "%d", &number ); ir dol 10 option_list(); scanf("%d" , &op); switch(op) { case 1: 19 divisors(number); Y. break; case 2: YY result = summation(number); printf("Summation = %d\n", result); break; YO case 3: result = factorial(number): printf("Factorial = %d\n", result); break; YY YA default: printf("\NERROR: %d is unrecognized option!!! \n", op); print_stars(); printf("Do you want to check another function? (Y/N)> "): scanf(" %c" , &flag); } while (flag == "Y" || flag == 'y'); rv return 0; . void option_list(){ print_stars(); printf("1: Find the divisors \n"); printf("2: Compute the summuation\n"); printf("3: Compute the factorial \n"); print_stars(); printf("Please enter your choice: "): EA void print stars() int i; for(i = 1;i<= 25;="" i++)="" printf("");="" 01="" or="" or="" printf("\n");="" 00="" 01="" void="" divisors(int="" n)="" {="" int="" i;="" printf("divisors="" of="" %d="" are\n",n);="" for(i="1;ic=n;i++)" if(n%i="0)" printf("="" %d",i);="" 09="" 1.="" printf("\n");="" 10="" lint="" factorial="" (int="" n){="" 11="" int="" i,="" fact="1;" for="" (i="2;"><= n; i++) fact * i; 14 return fact; vi int summation(int s){ if (s == 0) vy return 0; else yo return s+ summation(s-1); n;="" i++)="" fact="" *="" i;="" 14="" return="" fact;="" vi="" int="" summation(int="" s){="" if="" (s="=" 0)="" vy="" return="" 0;="" else="" yo="" return="" s+="">
Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here