1 2 Max Var a b Max Real

  • Slides: 22
Download presentation
1

1

2

2

 ﺩﻭ ﻋﺪﺩ Max ﺑﺮﻧﺎﻣﻪ ﻣﺤﺎﺳﺒﻪ Var a, b, Max : Real; Begin Readln

ﺩﻭ ﻋﺪﺩ Max ﺑﺮﻧﺎﻣﻪ ﻣﺤﺎﺳﺒﻪ Var a, b, Max : Real; Begin Readln (a); Readln (b); Max : = a; If ( b > a ) Then Max : = b; Writeln (Max); End. 5

 ﺑﺮﻧﺎﻣﻪ ﻧﻤﺎﻳﺶ ﺭﻭﺯﻫﺎی ﻫﻔﺘﻪ Var Begin End. day : Integer; Readln (day); If

ﺑﺮﻧﺎﻣﻪ ﻧﻤﺎﻳﺶ ﺭﻭﺯﻫﺎی ﻫﻔﺘﻪ Var Begin End. day : Integer; Readln (day); If (day = 1) Then If (day = 2) Then If (day = 3) Then If (day = 4) Then If (day = 5) Then If (day = 6) Then If (day = 7) Then Writeln Writeln (‘Sat’); (‘Sun’); (‘Mon’); (‘Tue’); (‘Wed’); (‘Thu’); (‘Fri’); 7

 ﺑﺮﻧﺎﻣﻪ ﺗﺎﺑﻊ ﺩﻭﺿﺎﺑﻄﻪ ﺍی Var x : Real; Begin Readln (x); If (

ﺑﺮﻧﺎﻣﻪ ﺗﺎﺑﻊ ﺩﻭﺿﺎﺑﻄﻪ ﺍی Var x : Real; Begin Readln (x); If ( x < 0 ) Then x : = x + 10; If ( x >= 0 ) Then x : = x - 10; Writeln (x); End. 8

 ﻣﺜﺎﻝ If ( x > 0 ) Then Writeln (x) Else Writeln (-x);

ﻣﺜﺎﻝ If ( x > 0 ) Then Writeln (x) Else Writeln (-x); If ( x > 0 ) Then Writeln (x) Else Writeln (x); 10

 ﺑﺮﻧﺎﻣﻪ ﺟﺰﺀ ﺻﺤﻴﺢ Var x, y : Real; Begin Readln (x); If (

ﺑﺮﻧﺎﻣﻪ ﺟﺰﺀ ﺻﺤﻴﺢ Var x, y : Real; Begin Readln (x); If ( x >= 1 ) Then If ( x < 2 ) Then y : = 1; If ( x >= 2 ) Then If ( x < 3 ) Then y : = 2; If ( x >= 3 ) Then If ( x < 4 ) Then y : = 3; Writeln (y); End. 12

 ﺑﺮﻧﺎﻣﻪ ﺟﺰﺀ ﺻﺤﻴﺢ Var x, y : Real; Begin Readln (x); If (

ﺑﺮﻧﺎﻣﻪ ﺟﺰﺀ ﺻﺤﻴﺢ Var x, y : Real; Begin Readln (x); If ( x >= 1 ) and ( x < 2 ) Then y : = 1; If ( x >= 2 ) and ( x < 3 ) Then y : = 2; If ( x >= 3 ) and ( x < 4 ) Then y : = 3; Writeln (y); End. 14

 ﺑﺮﻧﺎﻣﻪ ﺗﺎﺑﻊ ﻋﻼﻣﺖ Var x, y : Real; Begin Readln (x); If (

ﺑﺮﻧﺎﻣﻪ ﺗﺎﺑﻊ ﻋﻼﻣﺖ Var x, y : Real; Begin Readln (x); If ( x > 0 ) Then y : = 1 Else If ( x < 0 ) Then y : = -1 Else y : = 0; Writeln (y); End. 17

 ﻣﺜﺎﻝ Var Begin End. a, b, c, s : Real; N : Integer;

ﻣﺜﺎﻝ Var Begin End. a, b, c, s : Real; N : Integer; Readln (N); If ( N = 2 ) Then Begin Readln (a); Readln (b); s : = a + b; End; If ( N = 3 ) Then Begin Readln (a); Readln (b); Readln (c); s : = a + b + c; End; Writeln (s); 20

 ﺑﺮﻧﺎﻣﻪ ﻣﺮﺗﺐ ﺳﺎﺯی ﺳﻪ ﻋﺪﺩ Var a, b, c : Real; Begin Readln

ﺑﺮﻧﺎﻣﻪ ﻣﺮﺗﺐ ﺳﺎﺯی ﺳﻪ ﻋﺪﺩ Var a, b, c : Real; Begin Readln (a); Readln (b); Readln (c); If (a>=b) and (b>=c) Then Writeln (a, b, c); If (a>=c) and (c>=b) Then Writeln (a, c, b); If (b>=a) and (a>=c) Then Writeln (b, a, c); If (b>=c) and (c>=a) Then Writeln (b, c, a); If (c>=b) and (b>=a) Then Writeln (c, b, a); If (c>=a) and (a>=b) Then Writeln (c, a, b); End. 21