##例1.1要求在屏幕上输出一下一行信息。
This is a program.
复制代码
1
2
3
4
5
6#include <stdio.h> int main() { printf("nanxiaohe.n"); return 0; }
运行结果如下:
##例1.2 求两个整数之和
复制代码
1
2
3
4
5
6
7
8
9
10
11#include <stdio.h> int main() { int a,b,sum; a=123; b=789; sum=a+b; printf("sum is %dn,sum"); return 0; }
运行结果如下:
##例1.3求两个数中较大者
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#include <stdio.h> int main() { int max(int x,int y); int a,b,c; scanf("%d,%d",&a,&b); c=max(a,b); printf("max=%dn",c); return 0; } int max(int x,int y) { int z; if(x>y)z=x; else z=y; return(z); }
运行结果如下:
最后
以上就是仁爱白昼最近收集整理的关于@[TOC](第一章 程序设计和C语言)的全部内容,更多相关@[TOC](第一章内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复