Program P1; var a, b,x : real; function p(a,b:real):real; begin p:=sqrt(a*x+b=0); end; begin write('Vvedite 4sla'); read(a, b); otvet:=p(a, b); write('p=', otvet:10:2); readln; end. 

Closed due to the fact that off-topic participants αλεχολυτ , aleksandr barakin , iluxa1810 , pavel , Pavel Mayorov 12 Nov '16 at 19:40 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - αλεχολυτ, aleksandr barakin, iluxa1810, pavel, Pavel Mayorov
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • four
    Ahahaah root of the equation and extracting the root are different things. - user31238
  • I vote against this issue, because it does not reflect the desire to understand - 4per
  • one
    @ 4per well, the code is there, it means something she did and tried, didn't she? or is there a blank text without a code? - Alexey Shimansky
  • @ Alexey Shimansky, I leave a comment not for a public discussion of my decision, but so that the author or a potential editor can understand what a minus is. Also this person will have the opportunity to notify me about the improvement in the issue. - 4per

1 answer 1

And what do you want to calculate here?

 sqrt(a*x+b=0) 

Do you compare ax+b with zero, and want to extract the root from the comparison result ? Right? :)

Since @alexolut thinks that this is not the answer, I’m just trying to foolishly ask what you think it is, chew for absolutely ... um, dummies.

[Boring Mentor Tone] The expression a*x+b=0 in Pascal is a comparison expression that returns a Boolean True/False value, which is not a numeric value from which you can calculate the square root ... You can cast types using the view construct sqrt(byte(a*x+b=0)) .

Well and still - the variable otvet not declared for you.

  • one
    To think for yourself is useful, of course. But the SO / question / answer format implies the need to have an answer in the message from the “answers” ​​section, rather than clarifying questions for further reflection. - αλεχολυτ
  • @alexolut this is true only for those questions that are going to be left on the site. And this question in any case will be deleted. - Pavel Mayorov
  • @PavelMayorov presence of answers with pluses reduces the likelihood of deleting a question. - αλεχολυτ
  • @alexolut, but voting to remove this probability increases xD - Pavel Mayorov
  • @PavelMayorov please explain in what situation this question can be deleted if there is an answer with a plus. - αλεχολυτ