Question
C Programming // use stdio.h, stdlib.h, string.h and math.h only. 1. Write a C program that takes exactly 5 integers from the user and store
C Programming // use stdio.h, stdlib.h, string.h and math.h only.
1. Write a C program that takes exactly 5 integers from the user and store them in an array called inputArray. Print them on the screen. Sample output is as follows:
Enter 5 values separated by spaces> 0 2 3 4 6 Input array is: 0 2 3 4 6
NOTE: Good programmers use #define macros where possible.
NOTE: scanf can read multiple values in one line of code.
2. Extend your program from 1. Now, the program should take another integer input n from the user, create a second array called the outputArray, store the nth power of the integers from inputArray in the outputArray. Display the values of both arrays.
Power of a number can be calculated with the pow() function defined in . Find out the syntax by reading this. Be careful about the input data types of the pow() function.
Sample output is as follows:
Enter 5 values separated by spaces> 0 2 3 6 4 Enter the value of n> 3 Input array is: 0 2 3 6 4 Output array is: 0 8 27 216 64
3. Write a function that returns the maximum value in outputArray in from 2.
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