40 likes | 156 Views
Control Structure. Syntax IF test THEN Statement 1 ELSE Statement 2 Example If a > 10 then ? “This No. is Greater then ten “ ELSE ? “this No. is Less then or equal 10 “ Note : ? Is Alternate of print statement.
E N D
Control Structure Syntax IF test THEN Statement 1 ELSE Statement 2 Example If a > 10 then ? “This No. is Greater then ten “ ELSE ? “this No. is Less then or equal 10 “ Note : ? Is Alternate of print statement. The second kind of control structure in GWBASIC is condition or decision making . In GWBASIC we use If .. Then .. Else statement. 2 ) If .. Then …Else The if keyword is used to execute a statement or block only if condition is true. If this condition is true, then statement is Execute otherwise ELSE statement will be execute. Design By : Sir Masood
Practical #16 Write a program to input your name , and basic salary from keyboard and Display pay slip. Pay slip consist of your name , basic salary , convince allowance , medical allowance , house rent , income tax , provident fund ,gross pay and net salary. Formulas are Con = bsal * 10 /100 It = bsal * 5/100 med = bsal * 15/100 pf= bsal * 7/100 hr = bsal * 20 /100 gpay = bsal +con+med+hr netsal = gpay – it - pf Design By : Sir Masood
10 Key Off : CLS 20 INPUT “Enter Your Name “ ; N$ 35 INPUT “Entre Your Basic Salary “ ;BSAL 40 Let Con = BSAL * 10/100 50 Let Med = BSAL * 15/100 60 Let HR = BSAL * 20/100 70 IF BSAL>5000 THEN Let IT = BSAL * 5/100 ELSE IT =0 80 Let PF = BSAL * 7/100 90 Let GPAY = BSAL + Con +Med +HR 100 Let NetSAl = GPAY - IT – PF 110 PRINT “Name is “;N$ 120 PRINT “Basic Salary Is “;BSAL 130 PRINT “Convince Allow. Is “;Con 140 PRINT “Medical Allow. Is “;Med 150 PRINT “House Rent Is “;HR 160 PRINT “Income Tax Is “;IT 170 PRINT “Provident Fund Is “;PF 180 PRINT “Gross Pay . Is “;GPAY 190 PRINT “NET Salary is “;NetSal 200 END Design By : Sir Masood
Out Put 1 if salary < 5000 Enter Your Name ? Umer Khan Enter Your Basic Salary ? 1000 Name is : Umer Khan Basic Salary is : 1000 Convince Allow. Is : 100 Medical Allow. Is : 150 Hose Rent Allow. Is : 200 Income Tax is : 0 Provident Fund is : 70 Gross Pay is : 1450 NetSalary is : 1330 Out Put 2 if salary > 5000 Enter Your Name ? Umer Khan Enter Your Basic Salary ? 6000 Name is : Umer Khan Basic Salary is : 6000 Convince Allow. Is : 600 Medical Allow. Is : 900 Hose Rent Allow. Is : 1200 Income Tax is : 300 Provident Fund is : 420 Gross Pay is : 8700 NetSalary is : 7980 Design By : Sir Masood