有了自己的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.
第一次
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.
相关文章推荐
- VTemplate模板引擎的使用--认识篇
- sticky组件的改进实现
- 安装Cygwin
- Toast小事例
- Java 动态加载
- python中pip的安装
- 关于子窗口与父窗口传值问题
- 【OpenCV】边缘检测:Sobel、拉普拉斯算子
- python中pip的安装
- 傅立叶变换与光学-1
- 贪心 1010
- GIS+=地理信息+容器技术(10)——Windows Server 2016的容器实践
- 线程安全的Java类
- VTemplate模板引擎的使用--入门篇
- 基于.NET的免费开源的模板引擎---VTemplate
- Eclipse中创建Maven多模块工程
- Microsoft Visual Studio 发展历史
- 二叉树
- Python 进阶——从 list 到 NumPy
- 序列化与反序列化