0% found this document useful (0 votes)
6 views

Assignment 2

Uploaded by

Pinjar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Assignment 2

Uploaded by

Pinjar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

MTL505 (Introduction to Computers and Programming)

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.

6. Write a program that to find out the roots of polynomial ax2 + bx + c

a When a = 0, b = 0, print out the appropriate message


b When a = 0, b! = 0, find out the roots.
c When a! = 0, b! = 0, find out the roots (include the possibility of real and complex
roots using goto statement)

You might also like