You are on page 1of 4

Outline

Week 2- Conditional Branching and Looping 2

Week 3- Arrays and Functions 1+1

Week 4- Pointers and Structures 1+1

Week 5- File Handling 1+1


Week 3: Arrays and Functions

Problem 3: WAP to find all the numbers x in the interval [a,b] such that the sum of the squares of the
digits of x is divisible by 7. Write a function to determine whether a given number satisfies the
condition mentioned above and use it in your program. Take the values of a and b from the user.

Problem 4: WAP to find the weighted sum of the first n numbers f[1], f[2], …, f[n], where f[n] is
defined by f[n] = f[n-1] + f[n-2] and f[1] = f[2] = 1. The weighted sum WS is given by
WS = w[1] * f[1] + w[2] * f[2] + … + w[n] * f[n], where w[i] = f[n-i]/S for i = 1, 2, …, n. S is the
sum of the numbers f[1], f[2], …, f[n].

Problem 5: WAP that will take a line of text from the user and then display the text backwards, using
arrays.

Week 4: Pointers and structures

Problem 1: WAP that will take a line of text from the user and then display the text backwards, using
pointers.

Problem 2: WAP to accept two square matrices of order 3 from the user in row-order. Then, using
pointers, display the product of the two matrices.

Problem 3: Using structures, write C functions to add, subtract and multiply complex numbers. Now,
take three coefficients a, b, c of a quadratic equation from the user. Then take a complex number from
the user and find out whether it is a root of the given quadratic equation using the functions you
developed for complex number operations.
Week 5: File Handling

Problem 1: WAP to accept a line of text from the user (all in lower case) and store that text in a file
named Plain.dat. Now, open that file, and process each character of the file in the following manner.
If the character is a non-alphabet, keep it as it is and write it to a file named Cryptic.dat. If it is an
alphabet, convert it to a number N such that the alphabet is the Nth alphabet in English. Now,
corresponding to N, generate a number C such that C = (N + K) modulo 26, where K is taken from the
user (just once for the entire session, not one for each character). Now, convert C to an alphabet such
that the alphabet is the Cth alphabet in English and write that alphabet to a file named Cryptic.dat.
When the processing of the Plain.dat is over, close it, display the contents of Cryptic.dat to the screen
and then close that file as well.

Problem 2: WAP to accept a line of text from the user and store it in a file. Then, open that file and
find the number of words in that file.

You might also like