C實踐項目4.4—玩數字

来源:互联网 发布:淘宝搜索排名首先类目 编辑:程序博客网 时间:2024/06/03 14:58

問題及代碼

/* * Copyright (c) 2016, CSDN  * All rights reserved * 文件名稱: 項目4--算數運算符与算數表達式(4).c  * 作    者: 韓兆駿  * 完成日期: 2016年11月1日  * 版 本 號: v1.0  *  * 問題描述:輸入3個雙精度實數,分別求出它們的和、平均值、平方和以及平方和的開方,并輸出所求出各個值。 */  #include <stdio.h>#include <math.h>int main(){double x, y, z;printf("Please input three real numbers : \n");scanf("%lf %lf %lf", &x, &y, &z);printf("sum is %lf\n", x + y + z);printf("average is %lf\n", (x + y + z)/3);printf("square is %lf\n", x*x + y*y +z*z);printf("sqrt of square is %lf\n", sqrt(x*x + y*y + z*z));return 0; } 
運行結果

0 0
原创粉丝点击