Example:
4 is divisible with 1,2 and 4.
My code so far:
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int P,count=0;
cout<<"Sisestage arv:\n"; /*Asks for user input*/
cin>>P; /* User input P*/
for(int a=1;a<=P;a++)
{
if(P%a==0)
{
count++;
}
if(count==2)
{
cout<<"Algarv.\n"; /* Provided option when the number is prime number*/
}
else
{
cout<<" Ei ole algarv \n"; /* This is where I am supposed to provide the numbers input is divisible with*/
}
getch();
}
}

New Topic/Question
Reply



MultiQuote






|