Question
use C PLEASE, NOTC++ 1) problem 1: The factorial of a nonnegative integer n is written n! (prononunced n factorial) and is defined as follows:
use C PLEASE, NOTC++ 1) problem 1: The factorial of a nonnegative integer n is written n! (prononunced n factorial) and is defined as follows: N!=nx(n-1)x(n-2)x...x 1 (for values of n greater than or equal to 1) and n!=1(for n=0). For example, 5!=5x4x3x2x1, which is 120. Write a program that reads a nonnegative integer from keyboard and use the for-loops to Computes and prints its factorial if the number input is smaller than 3 Computes and prints the square of factorial value for the input number if the input number is larger or equal to 3. For example, if you input 6, the output should be 720*720=51,840. Show the result for both cases. NOTE: you must use one main function to realize the both cases, instead of two separated main. 2) Problem 2: Develope a structured C program to 1)enters 3 numbers from the keyboard; 2) call function Max by value to find the maximum of the three numbers and print it on screen; 3)call function Min by value to find the minimum of the three numbers and print it on the screen; 4)calculate the difference between the maximum and minimum; 5)print the difference on screen if the difference >=8; but print on screen The difference between the maximum and the minimum is less than 8! if the difference <8. Max function takes 3 numbers from the main program, compares and returns the maximum. Min function takes 3 numbers from the main program, compares and returns the minimum. 3) Problem 3: Define two arrays x={3,5,7,9,11,13,15} and f={2,4,6,8,10,12,16}, each of size 7. Use call-by-reference (that is, use pointer) to pass the array to a function, named summation. In main: define arrays, print the arrays, pass the arrays to the function and print the summation result on screen In function summation: take arrays from main and sum the arrays using the formula below: NOTE: you must use call-by-reference (the pointer) to call functions, as required; otherwise,
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started