C语言程序设计

//张洪 201752 C语言程序设计

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,d,three;
    printf("输入三位数");
    scanf("%d",&three);
    a = three%10;
    b = (three/10)%10;
    d = three/100;
    printf("%d %d %d\n", a, b, d);
    return 0;
}

三位数

好几天没有写程序了,基本输入语法都忘记了。要加强复习呀。。

浮点数

//张洪 2017、5、2 C语言程序设计

#include <stdio.h>
#include <stdlib.h>

int main()
{
    float f;
    int x, y;
    printf("input float\n");
    scanf("%f",&f);
    printf("%.3f\n",f);//输出三位数的浮点数
    x=f;//通过整形数据和浮点型数据的转换提
    //取小数点前三位的数据
    y=(int)(f*1000)%1000;//得到小数点后三位的数
    printf("%d %d\n", x, y);
    return 0;
}


include

include

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a=10;
    a=(3*5,a+4);//3*5对a的值无影响
    printf("a=%d\n",a);
    printf("Hello world!\n");
    return 0;
}

“`

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值