Ask Question
17 January, 02:08

Write a complete program that declares an integer variable, reads a value from the keyboard into that variable, and writes to standard output the variable's value, twice the value, and the square of the value, separated by spaces. besides the numbers, nothing else should be written to standard output except for spaces separating the values.

+2
Answers (1)
  1. 17 January, 05:28
    0
    The programming language to use here is not stated, so standard output is not clear. A solution using text boxes for input and output can be given in Delphi:

    unit Unit2;

    interface

    uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;

    type TForm2 = class (TForm)

    Edit1: TEdit;

    Edit2: TEdit;

    procedure FormCreate (Sender: TObject);

    private { Private declarations }

    public { Public declarations }

    end;

    var Form2: TForm2;

    implementation

    {$R *. dfm}

    procedure TForm2. FormCreate (Sender: TObject);

    var i: integer;

    txtline: string;

    begin

    i : = StrToInt (edit1. text);

    txtline : = IntToStr (i) + ', ' + IntToStr (2 * i) + ', ' + IntToStr (i * i); edit2. text : = txtline;

    end;

    end.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a complete program that declares an integer variable, reads a value from the keyboard into that variable, and writes to standard ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers