码迷,mamicode.com
首页 > 其他好文 > 详细

白皮 Chapter 1

时间:2015-06-30 01:19:28      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:

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

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

技术分享
#include<stdio.h>
#include<math.h>

int main()
{
    int a,b,c;
    double ave;
    scanf("%d%d%d",&a,&b,&c);
    ave=(a+b+c)/3;
    printf("%.3lf",ave);
    return 0;
}
average
技术分享
#include<stdio.h>
#include<math.h>

int main()
{
    double f,c;
    scanf("%lf",&f);
    c=5*(f-32)/9;
    printf("%.3lf",c);
    return 0;
}
temperature
技术分享
#include<stdio.h>
#include<math.h>

int main()
{
    int n,s;
    scanf("%d",&n);
    s=(1+n)*n/2;
    printf("%d",s);
    return 0;
}
sum
技术分享
#include<stdio.h>
#include<math.h>

int main()
{
    int n;
    double m;
    const double pi=4.0*atan(1.0);
    scanf("%d",&n);
    m=(float) n/180*pi;
    printf("%.3lf %.3lf",sin(m),cos(m));
    return 0;
}
sincos
技术分享
#include<stdio.h>
#include<math.h>

int main()
{
    double x1,y1,x2,y2,d;
    scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
    d=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    printf("%.3lf",d);
    return 0;
}
distance

白皮 Chapter 1

标签:

原文地址:http://www.cnblogs.com/Sky-Grey/p/4609259.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!