 ASSIGNMENT I

PROGRAMMING IN ‘C’

B.C.M. II YEAR

Session 2009-2010

NOTE : Students are required to submit program listings alongwith output reports by 15.01.2010. A soft copy of all the programs (Assignment I and II) should also be submitted with the file on CD.

SECTION - 1

1.      Write a program that will print 1 if a given integer is odd or a 0 if even.

2.      Write a program that generates ASCII values between 33 and 126 and prints a table of characters represented by them.

3.      Write a program that determines whether a given character is an uppercase vowel or not (without using any library function).

4.      Given three sides a,b,c, of a triangle. Write a program that prints the area of the triangle. First check whether a,b,c, can form a triangle or not. (Hint : a,b,c, can form triangle if each side is less than the sum of the other two sides)

5.      Write a program that generates and prints first N terms of the Fibonacci series, First few terms are:

0,1,1,2,3,5,8,13---------------------------.

6.      Write a program to compute the sum of the terms of the followings series:

a)            1+2+3+4+5+---------------------------------- up to N terms

b)            1+3+5+7+9+---------------------------------- until the sum>500

c)            2-4+6-8+10  ---------------------------------- up to N terms

d)                1+32 +52+72+---------------------------------  until the sum >30,000

e)            295+291+287+283--------------------------- up to 50 terms

f)              1+2/4+3/16+4/64+---------------------------- up to N terms

g)            1/a+2/(a+b)+3/(a+2b)+4/(a+3b)+-----------up to N terms

7.  Suppose x,y,z  are the following functions of  t:

x = t3 - 8t + 4,   y = Sin t + Cos 2t,   z = e3t+5

write a program which reads in t and prints t,x,y,z.

8.  The commission on a salesman’s total sales is as follows:

a)         If sales <100, then there is no commission.

b)         If 100£sales £500, then commission = 10% of sales.

c)         If sales > 500, then commission = 100+8% of sales above 500.

9.      Write a program that finds the largest and smallest number in a given set of numbers. Store given numbers in an array.

10.  Write a program to find the greatest common divisor of the two given positive integers.

11.  Write a program which will determine the storage requirement for various data types on your computer.

12.  Write a program that prints a given positive integer in reverse order and also sum of the individual digits  involved in the given integer.

13.  Write a program that prints all prime numbers between 0 and a given +ve integer n such that n > 0.

14.  Write a program that calculates the variance and the standard deviation for any given set of data.

15.  Suppose an amount of Rs. 5000/-was deposited in a savings a/c in 1980, and suppose the bank pays 6%  interest on the account compounded annually, Write a program which prints a table showing year and the amount of the account until year 2000.