Линейно уравнение

Да се напише програма, която решава линейно уравнение от вида a.x+b=0

Публикувано в с етикети . Постоянна връзка.

8 Responses to Линейно уравнение

  1. Alya каза:

    /pascal
    program AlyaIVikiV;
    var
    a, b, x: real;
    begin
    Write(‘Vavedete a: ‘);
    ReadLn(a);
    Write(‘Vavedete b: ‘);
    ReadLn(b);
    if a=0 then
    if b=0 then
    Begin
    WriteLn(‘Vsqko x e reshenie’);
    ReadLn;
    End
    else
    Begin
    WriteLn(‘Nqma reshenie’);
    ReadLn;
    end
    else begin
    x:= -(b/a);
    WriteLn(‘X e: ‘, x:5:2);
    end;
    Readln;

    end.
    /pascal

  2. svetlieti каза:
    program project1;
    var
      a,b,x:real;
    begin
      Writeln('Vavedi a i b');
      Readln(a,b);
      if a=0 then
         if b=0 then
            begin
            Writeln('Vsqko x e reshenie');
            Readln
            end
         else
         begin
         Writeln('Nqma reshenie');
         Readln
         end
      else
      begin
        x:=-(b/a);
        Writeln('x e ',x:5:2);
        Readln;
      end;
    end.
    
  3. svetlieti каза:
    program project1;
    var
      a,b,x:real;
    begin
      Writeln('Vavedi a i b');
      Readln(a,b);
      if a=0 then
         if b=0 then
            begin
            Writeln('Vsqko x e reshenie');
            Readln
            end
         else
         begin
         Writeln('Nqma reshenie');
         Readln
         end
      else
      begin
        x:=-(b/a);
        Writeln('x e ',x:5:2);
        Readln;
      end;
    
    end. 
    
  4. Боряна каза:
     
    program lineino_uravnenie;
    var
      a, b, x: Real;
    begin
      WriteLn('Tazi programa reshava uravnenia ot vida ax+b=0');
      WriteLn('Vavedi a:');
      ReadLn(a);
      WriteLn('Vavedi b:');
      ReadLn(b);
    
      if a=0 then
         if b=0 then
             WriteLn('Vsiako x e reshenie')
         else
             WriteLn('Niama reshenie')
      else
          begin
            x:=-(b/a);
            WriteLn('x e ', x:6:2);
          end;
      ReadLn;
    end.
    

Вашият коментар