Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9228627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:22:15+00:00 2026-06-18T05:22:15+00:00

I am making a program of prime number in FreePascal. How to output number

  • 0

I am making a program of prime number in FreePascal.

How to output number divides with I1,I2 separated with commas instead of 2 lines?

var
  P:Integer;
  I:Integer;
  J:Integer;
  A:Integer;

  begin

    writeln('Prime number program');
    writeln;
    writeln('Insert number');
    readln(P);

    for I:=2 to P-1 do
    begin
      J:=P Mod I;
      if (J=0) then
      begin
        writeln(P,' divides with ',I);
        a:=a+1
      end;
    end;

    if a=0 then
      begin
      writeln(P,' is prime number')
      end;
  end.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:22:16+00:00Added an answer on June 18, 2026 at 5:22 am

    I know it’s not a good way to teach you something, but here it is:

    program Project1;
    uses
      SysUtils;
    var
      S: string;
      I: Integer;
      Count: Integer;
      Input: Integer;
    begin
      Writeln('Prime number program');
      Writeln;
      Writeln('Insert a number:');
      Readln(Input);
    
      for I := 2 to Input-1 do
      begin
        if (Input mod I = 0) then
        begin
          Count := Count + 1;
          if (S <> '') then
            S := S + ', ';
          S := S + IntToStr(I);
        end;
      end;
    
      if (Count = 0) then
        Writeln(Input, ' is a prime number.')
      else
        Writeln(Input, ' is not a prime number. It divides with ', S, '.');
      Readln;
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a program that creates a grid with a number of lines and
I'm making a program where the user enters a number, it the program prints
I'm making a prime number sieve using Eratosthenes Sieve in C++ using multiple threads,
I'm making a program that takes names from the user seperated by commas. The
Lets say I'm making a program that needs to copy all the lines in
I'm making this program for a class and I need to guess a number's
I am making a program that estimates pi through increasing the number of sides
i am making a program to add a list numbers separated by a comma
I making a program in which a single line of input containing an integer,
I am using the cool map making program DIY map and i want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.