Lesson 02 - Datatype and variable (C++)

 Activity

1.  Write a C++ program that store two integer variables in the memory. Calculate and display all arithmetic operation results (addition +, subtraction -, multiplication *, division / & modulus %)

2.     Write a C++ program that store the following values and display them with their suitable data types. Values:- 15, 6.54, K, true, 12.78945, 178, s.

For e.g.      15 is a int data type value

                  K is a char data type value

                  12.78945 is a float data type value

3.      Write a C++ program to prompt the user to input an integer number, a double number and a character and display them.

4.      Write a C++ program that prompt the user to input two decimal numbers (floating point). Calculate and display the summation, subtraction, multiplication and division of the decimal numbers.

5.      Write a C++ program that prompt the user to input the length and width of a rectangle. Calculate and display the Perimeter and Area of the rectangle.

6.      Write a program that takes as input given lengths expressed in feet and inches. The program should then convert and output the lengths in centimeters. Assume that the given lengths in feet and inches are integers.


Post a Comment

0 Comments