Assignment 2
Assignment 2
Assignment #2,
1. Write a program that prints a table of trigonometric values for sin(),cos() and tan().
The angles in your table should go from 0 to 2π in 20 steps.
2. Ask the birth month of your classmates (more than five, if someone does not mind)
and find out the month in which maximum batch-mates of M.Sc batch are born.
3. Declare the enumeration data types colors which can take any five values of distinct
colors. Then declare two variable foreground and background and assign them black
and white respectively.
4. Write a programme to declare the new data type age whose original type is int and
then ask age of five of your classmates and find out the total age.
5. Write a program that reads in an integer value for n and then sums the integer from
n to 2n if n is nonnegative, or from 2n to n if n is negative. Write the code in two
versions, one using only for loops and the other using only while loops.