$24
Assignment
Write a program that reads a char as input, and determines if it is a lowercase letter, uppercase letter, a digit or something else (call this a special character).
The Taylor series expansion for the exponential function, for small values of x is given by:
ex = 1 + x + x2 + x3 + : : :
2! 3!
Write a program that takes as input the value of x (for example 0:01), and computes ex using the above approximation. The program should sum up n terms, and stop when the value of the nth term is less than a prede ned constant accuracy, set to 0:00001.
Write a program to generate m random integers from an array of size n, such that the probability of selecting even elements is twice that of odd elements. The same element may
be selected multiple times. As an example, let n = 100 and m = 30. Read in the array elements from the provided data le ArrayInp.dat, using the fscanf() function. Utilize the function rand() to generate a pseudo random number and the function srand() to seed the random number generator. Start with the code RandomArrayGenerate.c provided on the Blackboard. An example on generating random numbers in a given range can be found at the link http : ==www:cplusplus:com=reference=cstdlib=rand=.
Design an algorithm, and write the code to nd all pairs of integers in a sorted array, which sum up to a speci ed value. For example, if the given array is
int arrN[10] = f1, 3, 7, 14, 22, 35, 44, 45, 46, 53g; and the speci ed sum is 49, the output would be:
3 46
14 35
The algorithm should work well for very large array sizes.
Write a program that initializes an array, and prints out its elements using the pointer notation and pointer incrementing.
In the le Cauchy.dat provided on the Blackboard, nd all occurrences of the word mathematician. For reading the data from the input le, you can use the fscanf() function with the %s speci er. Utilize the string function strcmp() for string comparison.
Grading
In addition to code functionality, there will be points for optimized algorithm, coding style and comments. A few useful comments would be su cient.
Assignment Submission
The Assignments must be submitted on the Blackboard, and should include the following:
All the C code, that is, source in .c format, for the programming problems.
A screen shot showing your program executing.
A le (can be hand written, maybe in .PDF or .JPG format), if necessary, for the other problems.