Masala 1.
Berilgan ikkita son. Agar birinchi son absolyut qiymat jihatidan
ikkinchi sondan katta bo‗lsa, u holda birinchi sonni besh marta kamaytirish, aks holda
sonlarni o‗zgarishsiz qoldirish dasturi tuzilsin.
Program misol;
Var x,y; real;
Begin
Read(x,y);
If abs(x) > abs (y) then x:=x / 5;
Write (x,y)
End.
Masala 2.
Agar temperatura T 30
0
dan oshib ketsa, u holda bosim P 10T
2
ga ,
30
0
dan kamayib ketsa, u holda 15 T
3
ga,30
0
ga teng bo‗lsa u holda bosim 10 T
3
+sin
2
T ga teng bo‗ladi. Shunday holatni ifodalovchi dastur tuzish.
Program temp;
Var P,T: real;
98
Begin
Read(T);
If T>30 then P:= 10*sqr(T) ;
If T<30 then P:= 15* exp(3*ln(T)) else P:=10* exp(3*ln(T)) +sqr(sin( T));
Write ('P= ', P)
End.
Tayanch iboralar
tarmoqlanuvchi hisoblash jarayonlari, shartsiz o‗tish operatori, operator belgisi,
shartli o‗tish operatori, mantiqiy ifoda, operator, tanlash operatori, operator selektori,
tanlash ro‗yxati elementi.
Nazorat va muhokama uchun savollar
1. Tarmoqlanuvchi hisoblash jarayoniga ta'rif bering.
2. Shartsiz o‗tish operatori va uning ishlatilishini aytib bering.
3. Shartli o‗tish operatorining to‗liq ko‗rinishi qanday?
4. Shartli o‗tish operatorining qisqa ko‗rinishi qanday?
5. Tarmoqlanuvchi hisoblash jarayonida ikkitadan ko‗p tarmoqdan iborat
bo‗lgan holni tushuntiring.
6. Tanlash operatori va uning dasturda ishlatilishi tartibini ayting.
99
10-bob. SODDA TAKRORLANUVCHI HISOBLASH JARAYONLARNI
DASTURLASH
30> Dostları ilə paylaş: |