白皮 Chapter 1

6.29 今天主要做了一些1.5中的小结和练习,果然换语言思路也要跟着变么…各种不爽啊不爽…

scanf各种忘记&,还有各种忘记return 0…

average
temperature
sum
sincos
distance

 

7.1 继续做习题…

#include<stdio.h>
#include<math.h>

int main()
{
    int n;
    scanf("%d",&n);
    if (n % 2==1) printf("no"); else printf("yes");
    return 0;
}
odd
#include<stdio.h>
#include<math.h>

int main()
{
    int s,n;
    double m;
    scanf("%d",&n);
    s=95*n;
    if (s>=300) m=((float) s)*0.85; else m=(float) s;
    printf("%.2lf",m);
    return 0;
}
discount
#include<stdio.h>
#include<math.h>

int main()
{
    double a;
    scanf("%lf",&a);
    if (a<0) a=-a;
    printf("%.2lf",a);
    return 0;
}
abs
#include<stdio.h>
#include<math.h>

int main()
{
    int a,b,c,t;
    scanf("%d%d%d",&a,&b,&c);
    //sort
    if (a>b) {t=a;a=b;b=t;}
    if (a>c) {t=a;a=c;c=b;}
    if (b>c) {t=b;b=c;c=t;}
    //determine
    if (c<a+b) {
        if (c*c==a*a+b*b) printf("yes"); else printf("no");
    }
    else printf("not a triangle");
    return 0;
}
triangle
#include<stdio.h>
#include<math.h>

int main()
{
    int y;
    scanf("%d",&y);
    if (y%4==0){
        if (y%400==0) printf("yes");
            else {if  (y%100==0) printf("no"); else printf("yes");}
    }
    else printf("no");
    return 0;
}
year

 

转载于:https://www.cnblogs.com/Sky-Grey/p/4609259.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值