Write a program that swaps values between different locations in a two dimensional array. Make sure that the locations between which the values are being exchanged are symmetric.
float f( float x ) ...
float area( float xmin, float xmax, int N, float *store )
{
float h = (xmax-xmin)/N; 9
// Calculate and store f(x) for each x.
int i;
for( i=0; i<N; i++ ) store[i] = f(xmin+i*h);
// Estimate the area.
float area = 0.0f;
for( i=0; i<N; i++ ) area += h * store[i];
return area;
}
(a) Consider first the loop at line 12, which calculates f(x) over a range of values of x, and
stores the results in an array store[N].
(i) Identify any data dependencies in this loop. Explain your answer.
(ii) On a shared memory CPU architecture and OpenMP, this loop can be parallelised by using a #pragma omp parallel for directive just before the loop. Provide pseudo- code for the actions performed by each thread in the case that there are p = 3 threads.
Write a program that swaps values between different locations in a two dimensional array. Make sure that the locations between which the values are being exchanged are symmetric.
Write a program that uses a two dimensional of 256 x 8 to store 8 bit binary representations of each of the characters of ASCII character set
Write a function that accepts three arguments a number n, and two characters s and t. The function convert n from s unit to t unit of similar physical quantities. You can choose one of the following types to use in your program:
1. Length
2. Temperature
3. Area
4. Volume
5. Weight
6. Time
Write a function that accepts a character ch and a number n as arguments. The function then displays an n x n grid filled with ch. Use the function in a program.
Design a C program to check whether the given strings are Is a Anagram or is not an Anagram".
Implement a C program to count total number of words in a string. The given input words can be of letters, digits and special character. For example, if "I love India" is given as input, the output should be the total number of words is 3".
Design a C program , From a set of array elements, find the number of occurrences of each element present in the given array.
Design a C program to list the
students name in alphabetical
order.