Closed Thread
Results 1 to 4 of 4

Thread: need help [ pascal functions ]

  1. #1
    Amonijack is offline Learning Programmer
    Join Date
    Apr 2009
    Posts
    56
    Rep Power
    0

    need help [ pascal functions ]

    Code:
    program ****;
    var
       function artsre(n,i:integer):real;
       i,n,zb:integer;
        artsre:real;
        a:array[1..10] of integer;
       begin
         function artsre(n,i:integer):real;
         for i:=1 to n do
         begin
           begin
             zb:=zb+a[i];
           end;
         artsre:=zb/n;
         end;
         write('numbers ? : ');
         readln(n);
         for i:=1 to n do
           begin
             write('put  ',i,' - number : ');
             readln(a[i]);
           end;
         writeln('arithmetic mean is ',artsre);
         readln;
       end;
    I start program with functions in pascal. This is my first program with function in pascal. i compiled this program but my compyler show to me a lot of bugs.
    where i make a mistake ? :S
    btw excellent forum

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: need help [ pascal functions ]

    Is that the complete program (I don't see the primary begin/end.)? What error messages are you getting? Also, I don't see a using statement.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    Amonijack is offline Learning Programmer
    Join Date
    Apr 2009
    Posts
    56
    Rep Power
    0

    Re: need help [ pascal functions ]

    Code:
    program ****;
    var
    i,n,zb:integer;
    a:array[1..10] of integer;
    
    
    function artsre(n:integer):real;
    begin
    for i:=1 to n do
    zb:=zb+a[i];
    artsre:=zb/n;
    end;
    
    begin
    write('numbers  ? : ');
    readln(n);
    for i:=1 to n do
    begin
    write('put  ',i,' - number : ');
    readln(a[i]);
    end;
    writeln('arithmetic mean is ',artsre(n):0:2);
    readln;
    end.
    is it ok now, i solve my bugs
    in the future .... expected a lot of questions from me
    i hope i'll find help

  5. #4
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: need help [ pascal functions ]

    I'll certainly do what I can
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 02-06-2011, 01:37 PM
  2. looking for Pascal Atl Example
    By morshu in forum Pascal and Delphi
    Replies: 0
    Last Post: 10-26-2010, 11:30 AM
  3. SQL Functions - SQL Encryption Functions
    By chili5 in forum Tutorials
    Replies: 8
    Last Post: 09-04-2009, 09:40 AM
  4. SQL Functions - Math Functions
    By chili5 in forum Tutorials
    Replies: 6
    Last Post: 09-02-2009, 02:11 PM
  5. C++ to Pascal
    By HDi in forum C and C++
    Replies: 2
    Last Post: 07-22-2008, 03:57 AM

Tags for this Thread

Bookmarks

Posting Permissions

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