### Teorija

Vienkārša programma ar dažādu gadījumu aplūkošanu
(Pirmās pakāpes vienādojums)

Svarīgi!
Programmas mērķis:
1) Palūgt lietotājam ievadīt koeficientus a un b (kā reālus skaitļus).
2) Izvadīt informāciju par lineārā vienādojuma ax=b risinājumu.

Jābūt definētiem dieviem mainīgajiem, kuros glabāt koeficientu a un b vērtības.
 $\phantom{\rule{0.147em}{0ex}}\mathbf{var}\phantom{\rule{0.147em}{0ex}}\text{A},\phantom{\rule{0.147em}{0ex}}\text{B}:\phantom{\rule{0.147em}{0ex}}\mathbf{real};\phantom{\rule{0.147em}{0ex}}$

Kā arī jāpalūdz lietotājam ievadīt vērtības.
 $\begin{array}{l}\phantom{\rule{0.147em}{0ex}}\mathbf{write}\left(\text{'}\mathrm{Ievadi}\phantom{\rule{0.147em}{0ex}}\mathrm{koeficientu}\phantom{\rule{0.147em}{0ex}}\text{A}:\phantom{\rule{0.147em}{0ex}}\text{'}\right);\phantom{\rule{0.147em}{0ex}}\\ \phantom{\rule{0.147em}{0ex}}\mathbf{readln}\left(\text{A}\right);\\ \phantom{\rule{0.147em}{0ex}}\mathbf{write}\left(\text{'}\mathrm{Ievadi}\phantom{\rule{0.147em}{0ex}}\mathrm{koeficientu}\phantom{\rule{0.147em}{0ex}}\text{B}:\phantom{\rule{0.147em}{0ex}}\text{'}\right);\phantom{\rule{0.147em}{0ex}}\\ \phantom{\rule{0.147em}{0ex}}\mathbf{readln}\left(\text{B}\right);\end{array}$

Ja a atšķiras no 0, tad ir tikai viens risinājums: $\frac{b}{a}$
 $\begin{array}{l}\phantom{\rule{0.147em}{0ex}}\mathbf{if}\phantom{\rule{0.147em}{0ex}}\left(\text{A}<>0\right)\phantom{\rule{0.147em}{0ex}}\mathbf{then}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{writeln}\left(\text{'}\mathbf{Atbilde}\phantom{\rule{0.147em}{0ex}}\mathbf{ir}\phantom{\rule{0.147em}{0ex}}\text{'},\phantom{\rule{0.147em}{0ex}}\text{B}/\text{A}:0:4\right)\phantom{\rule{0.147em}{0ex}}\mathbf{\left\{}4\phantom{\rule{0.147em}{0ex}}\mathit{cipari}\phantom{\rule{0.147em}{0ex}}\mathit{aiz}\phantom{\rule{0.147em}{0ex}}\mathit{komata}\mathbf{\right\}}\phantom{\rule{0.147em}{0ex}}\\ \phantom{\rule{0.147em}{0ex}}\mathbf{else}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{if}\phantom{\rule{0.147em}{0ex}}\left(\text{B}=0\right)\phantom{\rule{0.147em}{0ex}}\mathbf{then}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{writeln}\left(\text{'}\mathrm{Ir}\phantom{\rule{0.147em}{0ex}}\mathrm{bezgaliigi}\phantom{\rule{0.147em}{0ex}}\mathrm{daudz}\phantom{\rule{0.147em}{0ex}}\mathrm{risinaajumu}\text{'}\right)\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{else}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{writeln}\left(\text{'}\mathrm{Risinaajums}\phantom{\rule{0.147em}{0ex}}\mathrm{neeksistee}\text{'}\right);\end{array}$
 $\begin{array}{l}\phantom{\rule{0.147em}{0ex}}\mathbf{program}\phantom{\rule{0.147em}{0ex}}\mathrm{piemeers3};\\ \phantom{\rule{0.147em}{0ex}}\mathbf{uses}\phantom{\rule{0.147em}{0ex}}\mathbf{crt};\\ \phantom{\rule{0.147em}{0ex}}\mathbf{var}\phantom{\rule{0.147em}{0ex}}\text{A},\phantom{\rule{0.147em}{0ex}}\text{B}:\phantom{\rule{0.147em}{0ex}}\mathbf{real};\\ \\ \phantom{\rule{0.147em}{0ex}}\mathbf{begin}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{clrscr};\\ \\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\left\{\mathit{Koeficientu}\phantom{\rule{0.147em}{0ex}}\mathit{ievade}\right\}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{write}\left(\text{'}\mathrm{Ievadi}\phantom{\rule{0.147em}{0ex}}\mathrm{koeficientu}\phantom{\rule{0.147em}{0ex}}\text{A}:\phantom{\rule{0.147em}{0ex}}\text{'}\right);\phantom{\rule{0.147em}{0ex}}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{readln}\left(\text{A}\right);\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{write}\left(\text{'}\mathrm{Ievadi}\phantom{\rule{0.147em}{0ex}}\mathrm{koeficientu}\phantom{\rule{0.147em}{0ex}}\text{B}:\phantom{\rule{0.147em}{0ex}}\text{'}\right);\phantom{\rule{0.147em}{0ex}}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{readln}\left(\text{B}\right);\\ \\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\left\{\mathit{Atbilstosjaas}\phantom{\rule{0.147em}{0ex}}\mathit{atbildes}\phantom{\rule{0.147em}{0ex}}\mathit{izvade}\right\}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{if}\phantom{\rule{0.147em}{0ex}}\left(\text{A}<>0\right)\phantom{\rule{0.147em}{0ex}}\mathbf{then}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{writeln}\left(\text{'}\mathbf{Atbilde}\phantom{\rule{0.147em}{0ex}}\mathbf{ir}\phantom{\rule{0.147em}{0ex}}\text{'},\phantom{\rule{0.147em}{0ex}}\text{B}/\text{A}:0:4\right)\phantom{\rule{0.147em}{0ex}}\mathbf{\left\{}4\phantom{\rule{0.147em}{0ex}}\mathit{cipari}\phantom{\rule{0.147em}{0ex}}\mathit{aiz}\phantom{\rule{0.147em}{0ex}}\mathit{komata}\mathbf{\right\}}\phantom{\rule{0.147em}{0ex}}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{else}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{if}\phantom{\rule{0.147em}{0ex}}\left(\text{B}=0\right)\phantom{\rule{0.147em}{0ex}}\mathbf{then}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{writeln}\left(\text{'}\mathrm{Ir}\phantom{\rule{0.147em}{0ex}}\mathrm{bezgaliigi}\phantom{\rule{0.147em}{0ex}}\mathrm{daudz}\phantom{\rule{0.147em}{0ex}}\mathrm{risinaajumu}\text{'}\right)\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{else}\\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{writeln}\left(\text{'}\mathrm{Risinaajums}\phantom{\rule{0.147em}{0ex}}\mathrm{neeksistee}\text{'}\right);\\ \\ \phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\mathbf{readkey};\\ \phantom{\rule{0.147em}{0ex}}\mathbf{end}.\end{array}$