C语言第一章作业
1.输出 This is a c test.
#include"stdio.h"
#include"stdio.h"
main()
{
printf("This is a c test. \n");
}
"****************************
2.输出 Very GOOD!
"****************************
#include"stdio.h"
"****************************
2.输出 Very GOOD!
"****************************
#include"stdio.h"
main()
{
printf("****************************\n");
printf(" Very GOOD! \n");
printf("****************************\n");
}
3.调用函数判断最大数并输出
#include"stdio.h"
4.输入3个数,输出最大数
#include"stdio.h"
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("程序出现未知错误");
}
浙公网安备 33010602011771号