当前位置:网站首页>Exercise 8-2 calculate the sum and difference of two numbers
Exercise 8-2 calculate the sum and difference of two numbers
2022-07-03 14:09:00 【ᯤ⁹ᴳ⁺ ·】
practice 8-2 Calculate the sum and difference of two numbers (10 branch )
This problem requires a simple function to calculate the sum and difference of two input numbers .
Function interface definition :
void sum_diff( float op1, float op2, float *psum, float *pdiff );
among op1 and op2 Are two real numbers entered ,*psum and *pdiff Is the calculated sum and difference .
Sample referee test procedure :
#include <stdio.h>
void sum_diff( float op1, float op2, float *psum, float *pdiff );
int main()
{
float a, b, sum, diff;
scanf("%f %f", &a, &b);
sum_diff(a, b, &sum, &diff);
printf("The sum is %.2f\nThe diff is %.2f\n", sum, diff);
return 0;
}
/* Your code will be embedded here */
sample input :
4 6
sample output :
The sum is 10.00
The diff is -2.00
void sum_diff( float op1, float op2, float *psum, float *pdiff ){
*psum=op1+op2;
*pdiff=op1-op2;
}
边栏推荐
- Go 1.16.4: purpose of go mod tidy
- jvm-运行时数据区
- 金属有机骨架材料ZIF-8包载姜黄素([email protected]纳米颗粒)|纳米金属有机框架搭载雷帕霉素|科研试剂
- Qt学习22 布局管理器(一)
- 玖逸云黑免费无加密版本源码
- JS general form submission 1-onsubmit
- Go language unit test 5: go language uses go sqlmock and Gorm to do database query mock
- Go language web development series 26: Gin framework: demonstrates the execution sequence of code when there are multiple middleware
- Redis: operation command of string type data
- 关于回溯问题中的排列问题的思考(LeetCode46题与47题)
猜你喜欢

信创产业现状、分析与预测

Common network state detection and analysis tools

核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)

Qt学习19 Qt 中的标准对话框(上)

Golang - command line tool Cobra

TS code automatically generates JS

FPGA test method takes mentor tool as an example

Scroll detection, so that the content in the lower right corner is not displayed at the top of the page, but is displayed as the mouse slides

Print. JS -- web page file printing

QT learning 23 layout manager (II)
随机推荐
Mysql:insert date:sql error [1292] [22001]: data truncation: incorrect date value:
Print. JS -- web page file printing
项目协作的进度如何推进| 社区征文
JS continues to explore...
Metal organic framework MOFs loaded with non steroidal anti-inflammatory drugs | zif-8 wrapped Prussian blue loaded quercetin (preparation method)
GoLand 2021.1.1: configure the multi line display of the tab of the open file
Onmenusharetimeline custom shared content is invalid, and the title and icon are not displayed
Message subscription and publishing
Scroll detection of the navigation bar enables the navigation bar to slide and fix with no content
Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
Comprehensive case of MySQL data addition, deletion, modification and query
叶酸修饰的金属-有机骨架(ZIF-8)载黄芩苷|金属有机骨架复合磁性材料([email protected])|制备路线
Qt学习23 布局管理器(二)
GoLand 2021.2 configure go (go1.17.6)
关于回溯问题中的排列问题的思考(LeetCode46题与47题)
selenium 浏览器(1)
Invalid Z-index problem
Toast UI editor (editor allows you to edit your markup document using text or WYSIWYG, with syntax highlighting, scrolling synchronization, real-time preview and chart functions.)
How to use lxml to judge whether the website announcement is updated
Go language web development series 27: Gin framework: using gin swagger to implement interface documents