Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

Basic C Programming

Basic C Programming

Basic C Programming

Introduction

In this assignment you will write small C programs. Each C program should be submitted as a

standard C source code file. You can submit your files separately or zipped together into one file.

 

Please note that the computer program should comply with the commenting and formatting rules

as has been done in class. For example, there should be a header for the whole program that gives

the author’s name, class name, date, and description. End braces should be commented, and there

are alignment and indenting requirements as discussed. Please ask if you have any questions.

Program #1 (15 points)

Write a program for each case (a to c). Each program will ask the user for an integer number n and

a character ch. The output generated depends on the value of n and the character ch.

 

For example, say that n = 5 and ch = ‘*’:

(5 points) Program 1.a) will display

* *** ***** ******* ********* (10 points) Program 1.b) will display:

* * * * * * * * * * * * * * * Notice: the number of spaces between each ‘*’ is increasing at each row.

 

(20 points) Program 1.c) will display

1* 2* 3* 4* 5*

2* 3* 4* 5* 1*

3* 4* 5* 1* 2*

4* 5* 1* 2* 3*

5* 1* 2* 3* 4*

 

 

CS 1325 Introduction to Programming

HW1: Basic C

 

 

Page 2

 

Program #2

Write a program to evaluate any function of order 5 or less at a given interval [xmin, xmax], and

display a table with the values of x, and f(x).

 

INPUT:

The program will ask the user to enter

a) (5 points) The function’s order f_order.

 If the order is greater than 5 or smaller than 1, an error message should be displayed and the program ends,

 Otherwise, the program will ask for the respective coefficients.

b) (5 points) The values for xmin and xmax

 If the value for xmax is smaller or equal to xmin, an error messages should be displayed and the program will end.

 

Assume that f(x) is defined as f(x) = ax5 + bx4 + cx3 + dx2 + ex + f.

 

(20 points) If the f_order is:

 5, then the program will ask for coefficients a, b, c, d, e and f;

 4, then the program will ask for coefficients b, c, d, e and f;

 3, then the program will ask for coefficients c, d, e and f;

 2, then the program will ask for coefficients d, e and f;

 1, then the program will ask for coefficients e and f;

 

OUTPUT:

 

The output is formatted as a table. The first column will display the values of x, and the second

column the values of f(x). The first row should always have the value xmin for x, and f(xmin) for

f(x). Last row should always have the value xmax for x, and f(xmax) for f(x).

 

The table will look like:

 

x f(x) ———–|——————- xmin | f(xmin) xmin +dx | f(xmin+dx) xmin +2dx | f(xmin+2dx) xmin +3dx | f(xmin+3dx) xmin +4dx | f(xmin+4dx) . | . | xmax | f(xmax) ——————————

 

 

CS 1325 Introduction to Programming

HW1: Basic C

 

 

Page 3

 

Where

 xmin is the value entered by the user, and

 f(xmin) is the result of evaluating the function when x=xmin

 dx is the increment size, and is defined by 𝑑𝑥 = (𝑥𝑚𝑎𝑥 − 𝑥𝑚𝑖𝑛)/10 Use 2 decimals for f(x) values.

 

Table formatting: 10 points

Function evaluation: 20 points

 

Include a report in a Word file that shows

a) List all the variables, constants(literals, symbolic and named) in your program 2). (5 points)

 

*Optional [Extra Points]:

 Include in the word file, plots of f(x) in the range [-13,13] for each valid value of f_order (10 points). You pick the coefficients for each case.

 

If you do not have access to MATLAB you can also use OCTAVE or SciLab.

 

You are allowed to use the function float pow( float, int), found in <math.h>, to calculate the powers of x.

 

Topics covered: Basic C, Expression evaluation, operators, flow control statements (loops,

switch-case, if-else, etc) and MATLAB as optionals

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: On Time Writers only hire the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by On Time Writers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. On Time Writers is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At On Time Writers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.