Variables & Data Types
(Assignment Questions)
Question 1 : In a program, input the side of a square. You have to output the area of
the square.
Input : n (side) Output
: n*n (area)
Question 2 : Enter cost of 3 items from the user (using float data type) - a pencil, a
pen and an eraser. You have to output the total cost of the items back to the user as
their bill.
(Add on : You can also try adding 18% GST tax to the items in the bill as an advanced
problem)
Question 3 : Build a Simple Interest Calculator.
Input : principal (P), rate (R), time (T)Output :
(P*R*T) / 100
Question 4 : Write a program to calculate the area of a circle.
Input : r (radius)
Output : PI*r*r (area)
Note - These questions are only to help you practice the concepts of this chapter.
These are not designed to test your mathematical skills, just to understand logic
building using C++.