Closed Thread
Results 1 to 2 of 2

Thread: Help! Pascal

  1. #1
    jen91 is offline Newbie
    Join Date
    Jan 2009
    Posts
    4
    Rep Power
    0

    Help! Pascal

    I have made a program that specifies whether a speech is a prime or not:
    and I need help to add some comments , can somebody help me please?
    Code:
    program Project5;
    
    {$APPTYPE CONSOLE}
    
    uses
      SysUtils;
    
    var stop: string;
          number   : integer;
          test : boolean;
    
    
    
           procedure faktorer;    
           var b,summa : integer;
            begin
              b:=1;
              sum:=number;
             repeat
    
              b:=b+1;
    
              if sum mod b =0 then
              begin
               sum:=sum div b;
               if sum=1 then write  (b,' = ',number)
               else write (b, ' * ') ;
    
                b:=1;
              end;
             until sum=1;
    
           end;
    
    
          procedure count;    //
          var i,sum: integer;
    
            begin
    
                i:=1;
                repeat
                  i:=i+1;
                  sum:=tal mod i;
    
                  if sum = 0 then
                    test:=false;
    
                until (i = tal-1) or (test = false);
    
            if test=false then writeln('this was no prime')
            else writeln('prime ');
          end;
    
    
    begin
      try
      repeat
        test:=true;
        writeln(inputting a number');
        readln(number);
    
          if tal <=2 then writeln('prime ')
          else
          begin;
        count;
          end;
    
          if test=false then  factors;
    
    
        writeln;
        writeln(do you want to test more?(y/n)');
        readln(stop);
       until stop='n';
    
    
      except
        on E:Exception do
        begin
          Writeln(E.Classname, ': ', E.Message);
        readln;
        end;
      end;
    end.
    Last edited by WingedPanther; 02-05-2009 at 04:51 PM. Reason: add code tags (the # button)

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

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

    Re: Help! Pascal

    Well, start with indicating what each function is for, and what the program as a whole is supposed to do.
    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. Pascal
    By Hunter100 in forum Pascal and Delphi
    Replies: 13
    Last Post: 02-16-2010, 01:21 PM
  2. GUI in Pascal
    By Davide in forum Pascal and Delphi
    Replies: 7
    Last Post: 01-25-2010, 04:35 AM
  3. From C to Pascal
    By Magmas in forum Pascal and Delphi
    Replies: 1
    Last Post: 08-25-2009, 01:33 PM
  4. Dev Pascal Help
    By Pyreforge in forum Pascal and Delphi
    Replies: 3
    Last Post: 11-16-2008, 07:27 AM
  5. Dev pascal help
    By ragingfear in forum General Programming
    Replies: 3
    Last Post: 11-21-2007, 01:23 PM

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