[學業]C++作業二
// classtest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std ;
int _tmain(int argc, _TCHAR* argv[])
{
int PrimeNumber = 1;
for(int i=1 ; i<100 ;i++)
{
for(int j=2 ;j<i; j++)
{
if (( i % j ) == 0)
{
PrimeNumber = 0;
break;
}
else
PrimeNumber = 1;
}
if ( PrimeNumber==1 )
{
cout << " " << i;
}
PrimeNumber = 0;
}
cin.get();
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.183.73
※ apple579:轉錄至看板 NTUBIME99-HW 10/26 22:49