Q. 23. Given the number of hours worked and the
hourly wage rate. Write a program to compute the gross
salary and net pay for the employee, assuming the
tax deduction to be at the rate of 20% of the employee's
gross salary, if it is less than RS. 1000/-, and at
the rate of 30% otherwise.
Solution.
CHARACTER *10 NAME
REAL HOURS, RATE
REAL GROSS, NET, TAX, TXRATE
READ *, NAME, HOURS, RATE
GROSS = HOURS * RATE
IF (GROSS .LT. 1000) THEN
TXRATE = 0.2
ELSE
TXRATE = 0.3
ENDIF
TAX = TXRATE * GROSS
NET = GROSS – TAX
PRINT *, NAME, GROSS, TAX, NET
STOP
END
Q. 24. Write a Program that reads an integer
N and computes N!. (June 99)
Solution.
INTEGER NUMBER, VALUE , N
10 READ *, NUMBER
IF (NUMBER .LT. 0) THEN
PRINT *, ‘POSITIVE NUMBER PLEASE’
GO TO 10
ENDIF
VALUE = 1
IF (NUMBER .EQ. 0) GO TO 30
DO 20 N = 2, NUMBER
VALUE = VALUE * N
20 CONTINUE
30 PRINT *, VALUE
STOP
END
|