Professional Documents
Culture Documents
Practice Problems in Programming
Practice Problems in Programming
1. Write a program that will calculate the Perimeter and Area of a rectangle given its length
and width (Hint: The formula for Rectangle’s Area is Length X Width. Formula for
Rectangle’s Perimeter is 2*Length + 2 * Width.
Sample Output:
Enter Length: 5
Enter Width: 3
Perimeter: 16
Area: 15
2. Write a program that will calculate the sum, difference, product, and quotient of 2 given
integer numbers.
Sample Output:
Enter first number: 3
Enter second number: 2
Sum: 5
Difference: 1
Product: 6
Quotient: 1