您的位置:首页 > 其它

有了自己的CSDN博客,希望自己在IT的道路上走得更远

2016-03-21 08:48 423 查看

第一次

1.

#include<stdio.h>

#include<math.h>

int main()

{

int i, j;

for (i = 100; i <= 200; i++)

{

for (j = 2; j <= i - 1; j++)

{

if (i%j== 0)

break;

else

printf("%d\n", i);

}

}

return 0;

}

2.

#include<stdio.h>

int main()

{

int i, j;

for (i = 1; i <= 9; i++)

{

for (j = 1; j <= i; j++)

{

printf("%d*%d=%d", i, j, i*j);

}

printf("\n");

}

return 0;

}

3

#include<stdio.h>

int main()

{

int year;

for (year = 1000; year <= 2000; year++)

{

if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)

printf("%d", year);

}

return 0;

}

第二次

1.

#include<stdio.h>

//#include <stdlib.h>

int main()

{

int a = 3, b = 7;

a = a^b;

b = b^a;

a = a^b;

printf("a=%d b=%d\n", a, b);

system("pause");

return 0;

}

2.

#include<stdio.h>

#include <stdlib.h>

int main()

{

int i ;

int a[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

int max = a[0];

for (i = 0; i <= 9; i++)

{

if (a[i] > max)

max = a[i];

}

printf("max=%d\n", max);

system("pause");

return 0;

}

第三次

1.#include<stdio.h>

#include<stdlib.h>

int main()

{

int A[3] = { 1, 2, 3 }, B[3] = { 2, 4, 6 },C[3];

int i;

for (i = 0; i < 3; i++)

{

C[i] = A[i];

A[i] = B[i];

B[i] = C[i];

}

for (i = 0; i < 3; i++)

printf("%d", A[i]);

printf("\n");

for (i = 0; i < 3; i++)

printf("%d", B[i]);

system("pause");

return 0;

}

2.

3.

#include<stdio.h>

#include<stdlib.h>

#include <conio.h>

int main()

{

int x, y, z, t;

scanf("%d%d%d", &x, &y, &z);

if (z > x)

{

t = x; x = z; z = t;

}

if (y > x)

{

t = x; x = y; y = t;

}

if (z > y)

{

t = y; y = z; z = t;

}

printf("%d%d%d", x, y, z);

system("pause");

return 0;

}

4.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: