C语言第一章作业
2013-10-24 15:51
190 查看
1.输出 This is a c test.
#include"stdio.h"
main()
{
printf("This is a c test. \n");
}
"****************************
2.输出 Very GOOD!
"****************************
#include"stdio.h"
main()
{
printf("****************************\n");
printf(" Very GOOD! \n");
printf("****************************\n");
}
3.调用函数判断最大数并输出
#include"stdio.h"
int max(int x,int y)
{
int z;
if (x>y) z=x;
else z=y;
return (z);
}
main()
{
int a,b,c;
scanf("%d %d",&a,&b);
c=max(a,b);
printf("max=%d",c);
}
4.输入3个数,输出最大数
#include"stdio.h"
main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a>b)
{
if(a>c)
printf("%d",a);
else if(c>b)
printf("%d",c);
}
else if(a<b)
{
if(b<c)
printf("%d",c);
else if(c>b)
printf("%d",b);
}
else
printf("程序出现未知错误");
}
#include"stdio.h"
main()
{
printf("This is a c test. \n");
}
"****************************
2.输出 Very GOOD!
"****************************
#include"stdio.h"
main()
{
printf("****************************\n");
printf(" Very GOOD! \n");
printf("****************************\n");
}
3.调用函数判断最大数并输出
#include"stdio.h"
int max(int x,int y)
{
int z;
if (x>y) z=x;
else z=y;
return (z);
}
main()
{
int a,b,c;
scanf("%d %d",&a,&b);
c=max(a,b);
printf("max=%d",c);
}
4.输入3个数,输出最大数
#include"stdio.h"
main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a>b)
{
if(a>c)
printf("%d",a);
else if(c>b)
printf("%d",c);
}
else if(a<b)
{
if(b<c)
printf("%d",c);
else if(c>b)
printf("%d",b);
}
else
printf("程序出现未知错误");
}
相关文章推荐
- 作业 1 熟悉C语言编程环境 第一章
- [置顶] 学生信息管理系统-C语言结课作业掺杂了一点c++
- C语言程序设计 第一章C语言概述.1
- C语言博客作业--一二维数组
- C语言博客作业--一二维数组
- C语言博客作业--一二维数组
- C语言第七次博客作业---一二维数组
- 数值作业:二分法求方程的根之C语言实现代码
- C语言——第四次作业
- C语言博客作业--字符数组
- 第一章c语言概述
- 《从汇编语言到Windows内核编程》学习笔记 (第一章 汇编指令与C语言)
- 网络1712--c语言一二维数组作业总结
- C语言第三次博客作业---单层循环结构
- 我也要学C语言-第一章:第一个C程序的代码初解
- 第一章 C语言介绍
- 简易计算器 (C语言)作业
- 使用C# 第一章课后作业
- c语言第二次作业
- C语言的第七天学习——作业