1 、代码
#pragma warning(disable : 4996)
#include<stdio.h>
#include<Windows.h>
#include<math.h>
int main()
{
int i = 0;
int j = 0;
for (i = 101; i < 200; i++)
{
for (j = 2; j <=sqrt(i); j++) /i = 13; j = 13; i = 8; j < i; [2,i/2]/
{
/优化:j<i; --> j = i; j <= i / 2; —>j>i / 2; j <= sqrt(i)------>j>sqrt(i)/
/i = 13------>j = [2, 6] 循环: j = 8; j <= i / 2;/
if (i%j == 0)
break;
}
if (j>sqrt(i))
printf(" %d " , i);
}
printf("\n");
system(“pause”);
return 0;
}
2、实验结果
3;两个数进行交换时,通常有三种方法,(1)创建临时变量;(2) 不用创建临时变量;(3)两个数的二进制异或;
(2)a=a+b;
a= a-b;
b=a-b;