0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

プログラミング始めました一日目

Last updated at Posted at 2013-11-15

#include
using namespace std;

int main() {
int x;
int y;

cout << "整数値 x: ";
cin >> x;
y = x;

for(int i = 2; i < x-1; i ++){
	//cout << "x/" << i <<" = " << i << "×" <<(x/i) << " + " << x%i << ";\n";
	if((x % i) < y){
		y = x%i;
	}
}
if(!(y == 0)){
	cout << x << "は素数です。YATTA!\n";
}else{
	cout << x << "は素数じゃねえよ!ふざけんな!\n";
}

return 0;

}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?