Tuesday, March 8, 2011

Latihan

1) solve the question below solve the working
   a) 5*2 % 3 + 25/5
       = 10 % 3 + 5
       = 1+5
       = 6

 b) a = 5, b = 6
      ! ( ( a < 3 ) < & ( a = = 3 ) ll ( b > a ))
      =     0                       0               0
                         0                      0
                         1                      1
                                   1/ true

2)identify the syntax errors in the following program
   include < iostream.h >
   main (  )
  {
  float allowance  = Rm 300.00 salary,
  Cout << "input salary = " ;
  Cin > salary = " ;
  T salary = salary + allowance ;
  Cout << " salary is = " << salary ;
  }

answer

   n #
   main (  )
   Cin >>
   return O;

3) write a program that will calculate the montly salary for an employee that where saturday & sunday are considered as no working days.

answer

# include  < iosterea m . h >
main (  )
{
// declare variable
float noworking days ;
float salaryperday ;
float monthly salary ;
// input 1
Cout << " noworkingdays";
Cin >> noworking days ;
// input 2
Cout << " enter salaryperday = ";
Cin salaryperdays ;
formula
monthly salary = noworking days * salary perday " ;
// output
Cout << " monthlysalary << monthly salary ;
return O
}

4) write a program that allowance their everege of  5 number that can be input by user.

answer

# include <iostream . h >
main (  )
{
float no 1
float no 2
float no 3
float no 4
float total
float average
// input 1
Cout << " num 1 " ;
Cin >> num 1 ;
// input 2

1 comment:

  1. kerje nie tak siap sbb ak tertidor..tersadar dah kul 3 pagi..ak ade mase beberape minit je tuk taip keje nie..akhirya ak tak sempat nak abiskn sbb ak kena bersiap tuk gi kerje..kelamkabut punye pasal mane entah ak punye kertas..aaarrrrggggghhh

    ReplyDelete