Question
Please answer the followin question in C Write a program which displays the first N happy numbers and then calculates the mean of those numbers
Please answer the followin question in C
Write a program which displays the first N happy numbers and then calculates the mean of those numbers and the equation of the linear trendline of a graph using the least square method where the happy number is on the y axis and their ordinal is on the x axis (for example, 1 is the first happy number ; therefore, (1,1) would be the first point on the graph). You do not need to display a graph, just calculate the equation of the linear trendline.
The program must have the following features :
An array to hold the happy numbers. It must be able to hold at least 200 happy numbers
A function to determine if a given number is happy
A function which accepts an array of numbers and returns their mean
A function which accepts two arrays of numbers and returns the slope of the line between those numbers
A function which accepts the means of two related sets of numbers and the slope and returns the yintercept.
Requests from the user how many happy numbers should be generated.
Prints a table of the requested number of happy numbers with proper heading. The average of the happy numbers should be printed, along with the equation of the linear trendline after the table
Follow and document the entire process: restate the problem, identify input and output, write the algorithm, test the algorithm by hand, write the program, test the program.
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