Assignment-2

divider
Question-1

Q1. WAP to practice math functions such as sin(), cos(), log(), pow(), sqrt() etc. by including <math.h> header file.

Question-2

Q2. WAP to find roots of a quadratic equation (for D>=0 case).

Question-3

Q3. WAP to format console output using '\n', '\t', '\b' within printf statement.

Question-4

Q4. WAP to implement assignment operators such as += , -= , *=, /= %= etc.

Question-5

Q5. Assignment operator assigns right hand side value to left hand side variable. Use this idea to interchange (swap) values of two variables. (Hint: You may need a third variable. Think like switching coffee and tea between two cups using a third cup).

Question-6

Q6. WAP to shift left and shift right operators (>> and <<). Ask the application of this operator to your lab instructor.

Question-7

Q7. WAP to utilize ternary operator (?:).

Question-8

Q8. WAP using sizeof() function to find size of char, integer, long int, float and double.

Question-9

Q9. WAP to divide two numbers and use type casting operation (e.g. mean = (double)sum/n;).

Question-10

Q10. String is set of characters (one next to each other stored in the memory and not related to each other), e.g. ="abc123". WAP to practice type casting using the following functions. You can initialize a string using statement char *s="3.145" Then s is a string.