• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
激 活
The world changed because of you .
            管理     

C语言第一章作业

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("程序出现未知错误");
}
posted @ 2013-10-24 15:51  激 活  阅读(204)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3