Followers

Wednesday, February 23, 2011

soalan exercises 1

1. Write correct C++ syntax & for each statement below:

a) Initializing variable Pi with the value 3.14 (constant)
b) Declare a variable named Parameter with double data type (declare variable)
c) Give instruction that allowed user to input data (input)
d) Input number of computer using variable (input assign to variable value)

2. Solve the question below. Show the working.

a) 5 * 2 % 3 + 25 / 5
b) a = 5, b = 6
!((a < 3) && (a == 3) || (b > 9))

3. Identify syntax errors in the following program.

include<iostream.h>
main()
{
float allowance = 300.00, salary;

cout<<"Input Salary = ";
cin>>salary;

TSalary = salary + Allowance;

cout<<"Salary is= "<< salary;
}

4. Write a program that will calculate the monthly salary for an employee that where Saturday and Sunday are considered as non-working days.

5. Write a program that calculates the average of 5 numbers that can be input by user.

6. Write a program that will calculate the area of rectangular, triangle and circle.

No comments:

Post a Comment