Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How do I even start this problem! Someone please help! C program Description Wri

ID: 3734246 • Letter: H

Question

How do I even start this problem! Someone please help! C program

Description Write a program that will compute either the Fibonacci Number (use the one from the homework), Factorial, or compute the quotient and remainder of x/y, where x and y are integers. The program must implement one function for each computation, as well as the main function and a function to determine which computation to carry out. The main function must also loop until the user is finished with the computations. In total, you must implement the following S functions 1. Main a. Arguments: None b. Return Type: Integer c. Description The Main Function displays a menu of the possible computation, calls the "DecideComputation" function, and then asks the user if he/she wants to do another computation. If yes, the process is repeated i. 2. DecideComputation a. Arguments: i. choice: integer b. Return Type: none c. Description The DecideComputation function makes a decision of which of the computation functions to call based on the passed in user choice i. 3. Factorial a. Arguments: i. n: integer b. Return Type: none c. Description The Factorial function computes the factorial of some number n, in which the limit to n should be 8 (i.e don't allow the user to enter a number larger than 8 because of memory size constraints). i. 4. Fibonacci a. Arguments: i. n: integer b. Return Type: none c. Description The Fibonacci function computes the Fibonacci number of some number n using arrays and loops. The limit is 30. Note: Just use the one from the homework i.

Explanation / Answer

Screenshot

-

-----------------------------------------------------------------------------------------------------------------------

Code:-

//Header file
#include <stdio.h>
//Remainder Quentient function
void findQRem(int num,int den){
   int q,r;
   if(den==0){
       printf(" Please enter a number other than 0");
   }
   else{
       q=num/den;
       r=num%den;
                printf(" Quotient of %d/%d =%d",num,den,q);
                printf(" Remainder of %d/%d =%d",num,den,r);
            }
}
//fibonacci finding function
void findFibonacci(int n){
   if(n>8 || n<=0){
       printf(" Please enter a number from 1-30 .");
   }
   else{
       int i;
                        long int arr[40];
                        arr[0]=0;
                        arr[1]=1;

                        for(i=2;i<n;i++){
                           arr[i] = arr[i-1] + arr[i-2];
                        }

                        printf(" Fibonacci series is: ");
                         for(i=0;i<n;i++)
                         printf("%ld ",arr[i]);
            }
}
//Facorial finding function
void findFactorial(int n){
   int i,factorial=1;
   if(n>8 || n<=0){
       printf(" Please enter a number from 1-8 .");
   }
   else{
       for(i=1; i<=n; ++i)
       {
           factorial *= i;              // factorial = factorial*i;
                 }
                        printf(" Factorial of %d = %d", n, factorial);
            
   }
}

//decide Which meu option chosen function
void decideComputation(int choice){
   int n,d;

      
   switch(choice){
       case 1:
                 
                   printf(" Please enter a number to find factorial(number<9):");
           scanf("%d",&n);
           findFactorial(n);
                   break;
          
                case 2:
                 
                   printf(" Please enter a number to find fibonacci series(number<31):");
           scanf("%d",&n);
           findFibonacci(n);
                   break;
                 case 3:
                 
                   printf(" Please enter numerator value :");
           scanf("%d",&n);
           printf(" Please enter denominator value :");
           scanf("%d",&d);
           findQRem(n,d);
                   break;
               case 4:
                   break;
   }
  
}
//main function
int main(void) {
   //variable declaration
   int ch;
   char dec;
         //Menu for user selection
   printf("       Welcome To Menu Driven Computation program !!!!     ");
   printf("              1.To find factorial");
   printf("              2.To find fibonacci series");
   printf("              3.To compute Remainder and Queficient ");
   printf("              4.Exit");
   //User choice
   printf(" Please enter your choice : ");
   scanf("%d",&ch);
   //Check validity
            if(ch>4 && ch<=0){
       printf(" Please enter choice 1-4 :");
       scanf("%d",&ch);
   }
   //Call function decide
   else{
       decideComputation(ch);
   }
   //Yes or no question to continue
   printf(" Do you want to continue y/n:");
   scanf(" %c",&dec);
   //Loop to continue the choice of calculation
   while(dec=='y' || dec=='Y'){
       printf("              1.To find factorial");
                printf("              2.To find fibonacci series");
                printf("              3.To compute Remainder and Queficient ");
               printf("              4.Exit");
               printf(" Please enter your choice : ");
               scanf("%d",&ch);
  
                if(ch>4 && ch<=0){
                   printf(" Please enter choice 1-4 :");
                    scanf("%d",&ch);
                 }
                         else{
                             decideComputation(ch);
                }
              printf(" Do you want to continue y/n:");
              scanf("%c",&dec);
  
   }

    printf(" Good Bye !!!!");
   return 0;
}


-----------------------------------------------------------------------------------------------------------------------------

Output

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote