C language. Please separate the code into different user defined function(Like scan seed, please use a function to scan

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

C language. Please separate the code into different user defined function(Like scan seed, please use a function to scan

Post by answerhappygod »

C language.
Please separate the code into different user defined
function(Like scan seed, please use a function to scan the value
and return it back to the main function)
it should be like:
function headers
int main{}
user defined function{}
user defined function{}
...
don't write everyting inside the main function
thankyou
C Language Please Separate The Code Into Different User Defined Function Like Scan Seed Please Use A Function To Scan 1
C Language Please Separate The Code Into Different User Defined Function Like Scan Seed Please Use A Function To Scan 1 (176.99 KiB) Viewed 50 times
C Language Please Separate The Code Into Different User Defined Function Like Scan Seed Please Use A Function To Scan 2
C Language Please Separate The Code Into Different User Defined Function Like Scan Seed Please Use A Function To Scan 2 (89.54 KiB) Viewed 50 times
Problem: Given a seed for the random number generator, a power (p) of 10 that represents the upper limit of the value to generate, begin by creating a data set of 1000 elements in the range from 0 to 10P - 1. For each number in this data set re-arrange its digits to make the largest integer possible. Display the five largest and smallest value found in the data set. Example Execution #1: Enter seed value -> 9000 Enter maximum power of ten for range -> 3 Largest 5 values in data: 999 998 997 997 997 Smallest 5 values in data: 1 3 5 6 7 Example Execution #2: Enter seed value -> 1000 Enter maximum power of ten for range -> 4 Largest 5 values in data: 9998 9997 9997 9992 9990 Smallest 5 values in data: 64 66 71 74 85 Example Execution #3: Enter seed value -> 6000 Enter maximum power of ten for range -> 5 Largest 5 values in data: 99987 99986 99973 99887 99886 Smallest 5 values in data: 90 92 652 663 721 Example Execution #4: Enter seed value -> 4000 Enter maximum power of ten for range -> 8 Largest 5 values in data: 99998622 99998521 99994431 99988755 99988652 Smallest 5 values in data: 77320 87600 654332 755331 765522 Example Execution #5: Enter seed value -> 2028 Enter maximum power of ten for range -> 6 Largest 5 values in data: 999961 999877 999861 999841 999762 Smallest 5 values in data: 0 755 971 6421 7632
Example Execution #6 (input validation demonstrated): Enter seed value -> 0 Error! Positive seed values only!! Enter seed value -> 9624 Enter maximum power of ten for range -> 9 Error! Power of ten cannot exceed eight! Enter maximum power of ten for range -> 0 Error! Power of ten must be positive!! Enter maximum power of ten for range -> 8 Largest 5 values in data: 99998665 99998531 99997732 99992000 99988742 Smallest 5 values in data: 98833 655310 765441 765442 864322
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply