Presentation is loading. Please wait.

Presentation is loading. Please wait.

เฉลยแบบฝึกหัด IF Program number; Uses wincrt; Var first,second : integer; Begin Write('input your first ');readln(first); Write('input your second');readln(second);

Similar presentations


Presentation on theme: "เฉลยแบบฝึกหัด IF Program number; Uses wincrt; Var first,second : integer; Begin Write('input your first ');readln(first); Write('input your second');readln(second);"— Presentation transcript:

1 เฉลยแบบฝึกหัด IF Program number; Uses wincrt; Var first,second : integer; Begin Write('input your first ');readln(first); Write('input your second');readln(second); If first > second Then write('first > second ',first-second) else write('first < second ',first+second); End.

2 Program number; Uses wincrt; Var score : integer; Begin Write('input your score ');readln(score); If score >= 50 Then write('pass') else write('fail'); End.

3 program cheak_weight; uses wincrt; var sex : char; tall,weight,weight_s : real; begin write('iput your sex F or M ');readln(sex); write('iput your tall ');readln(tall); write('iput your weight ');readln(weight); IF sex = 'F' Then weight_s := tall-110 else weight_s := tall-100; IF weight > weight_s then begin writeln('your are fat'); writeln('your weight_s is ',weight_s:3:2); writeln('weight overload is ',weight-weight_s:3:2); end else begin write('your are thin'); writeln('your weight_s is ',weight_s:3:2); writeln('weight overload is ',weight-weight_s:3:2); end; end.

4 Program number; Uses wincrt; Var num,result : integer; Begin Write('input number ');readln(num); result := num mod 2; If result = 0 Then write('ku') else write('ke'); End.

5 Program Case_Example; Uses wincrt; Var ans:integer; base, tall,area_t : real; num1,num2:integer; Begin writeln('**********area**********'); writeln('**********1.area tritangle**********'); writeln('**********2.area squar **********'); writeln('**********3.area circle**********'); write('Select area 1-3');readLn(ans); Case ans of 1 : begin write('input base');readln(base); write('input tall');readln(tall); area_t := 1/2*base*tall; writeln('area tritangle',area_t:3:2); end; 2 : begin end; Else writeLn('Error') End; End.


Download ppt "เฉลยแบบฝึกหัด IF Program number; Uses wincrt; Var first,second : integer; Begin Write('input your first ');readln(first); Write('input your second');readln(second);"

Similar presentations


Ads by Google