C++:
#include <iostream>
using namespace std;
int main()
{
for(a=1;a<4;a++)
{
cout<<a<<" is a prime number."<<endl;
}
for(int num=1;num<200;num++)
{
for(int i=2;i<num;i++)
{
int j=num%i;
int k=num/i;
if (j!=0&&i==num/2)
{
cout<<num<<" is a prime number."<<endl;
break;
}
if(j==0)
{
cout<<num<<‘=‘<<i<<‘*‘<<k<<endl;
break;
}
}
}
}
时间: 2024-10-26 22:47:25