C 语言实例 - 两个浮点数相乘

C 语言教程 · 2019-02-20 14:41:30

输入两个浮点数,计算乘积。

实例

#include <stdio.h> int main() { double firstNumber, secondNumber, product; printf("输入两个浮点数: "); // 用户输入两个浮点数 scanf("%lf %lf", &firstNumber, &secondNumber); // 两个浮点数相乘 product = firstNumber * secondNumber; // 输出结果, %.2lf 保留两个小数点 printf("结果 = %.2lf", product); return 0; }

运行结果:

输入两个浮点数: 1.2 2.345
结果 = 2.81

点击查看所有 C 语言教程 文章: https://www.codercto.com/courses/l/17.html

查看所有标签

The Elements of Statistical Learning

The Elements of Statistical Learning

Trevor Hastie、Robert Tibshirani、Jerome Friedman / Springer / 2009-10-1 / GBP 62.99

During the past decade there has been an explosion in computation and information technology. With it have come vast amounts of data in a variety of fields such as medicine, biology, finance, and mark......一起来看看 《The Elements of Statistical Learning》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具