Results 1 to 2 of 2

Thread: Pascal: printing 3-digit number in reverse order

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Location
    Baytown, TX United States
    Posts
    19

    Post

    I need a Pascal program that allows the user
    to enter a three-digit number and the number will print in reverse order. The reverse number should use a variable and it shouldn't print each of the digits separately.

  2. #2
    Addicted Member
    Join Date
    Sep 1999
    Posts
    229

    Post


    kazooie21,

    I don't really remember the whole syntax
    (long time I've never used Pascal),
    hope this can help

    ---------

    var mystring = string;
    d1, d2, d3 = integer;

    uses crt;

    Begin


    write "please enter digit 1";
    readln (d1);
    write "please enter digit 2";
    readln (d2);
    write "please enter digit 3";
    readln (d3);
    mystring = str(d3) + str(d2) + str(d1)
    writeln "result = " + mystring

    readkey;

    End

    -------

    By the way this is VB forum

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width