Question: I. (30pts) Develop a code to meet the following requirements: 1) keep on entering numbers until user enters a number smaller than 0 or larger
I. (30pts) Develop a code to meet the following requirements: 1) keep on entering numbers until user enters a number smaller than 0 or larger than 50; 2) print the maximum of the numbers entered; 3) print the sum of all the odd numbers entered. 2. (30 pts) Develop a structured C program to calculate the perimeter of a triangle. Your program must be structured as follows: main program and one function. Main program inputs all three sides a, b and c, and calls the function P by using a, b and c as input. Print the returned value from function P on screen. Function P takes data from the main program. If atbec or atecb or btcca, print an error message "This is not a triangle!" and return -1 to the main. Else, return a+b+c (1) Run the code for a-3, b-4 and c-8, and show the screenshot of the result (2) Run the code for a=5, b-6 and c-10, and show the screenshot of the result 3. (40 pts) Define an array f= [ 11,-23,34,-8,-10,18,29], using call-by-reference (that is, use of pointers), to pass the array to a function, named Summation. In main: define array, pass array, print out the array and the result returned from Summation on screen In function Summation: 1) take array and size from main 2) sum each element according to the following rules 3) if the value of f(i) is positive, add 3*f) to the sum 4) if the value of fi) is negative, add -2* f(i) to the sum 5) return the final value of sum to main NOTE: you must use call-by-reference (the pointer) to call functions, as required; otherwise, no credits will be given
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
