当前位置:网站首页>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;
}
边栏推荐
- 3D vision - 2 Introduction to pose estimation - openpose includes installation, compilation and use (single frame, real-time video)
- 信创产业现状、分析与预测
- Record 405 questions about bank callback post request
- JVM runtime data area
- “又土又穷”的草根高校,凭什么被称为“东北小清华”?
- 使用vscode查看Hex或UTF-8编码
- MIL-100( Fe) 包裹小分子阿司匹林形成[email protected](Fe)|甘草次酸修饰金属有机框架材料UiO-66-NH2(简称UiO-66-NH2-GA)
- 虽然不一定最优秀,但一定是最努力的!
- Global event bus
- Print. JS -- web page file printing
猜你喜欢
[email"/>Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email

Exercise 7-6 count capital consonants

3D vision - 2 Introduction to pose estimation - openpose includes installation, compilation and use (single frame, real-time video)

MySQL 数据增删改查综合案例

Use and design of Muduo buffer class

JVM object lifecycle

好看、好用、强大的手写笔记软件综合评测:Notability、GoodNotes、MarginNote、随手写、Notes Writers、CollaNote、CollaNote、Prodrafts、Noteshelf、FlowUs、OneNote、苹果备忘录

全局事件总线

Message subscription and publishing

Spring cup eight school league
随机推荐
jvm-类加载
Common plug-ins for vite project development
Qt学习20 Qt 中的标准对话框(中)
Exercise 7-6 count capital consonants
Dynamic programming 01 knapsack and complete knapsack
Doxorubicin loaded on metal organic framework MIL-88 DOX | folic acid modified uio-66-nh2 doxorubicin loaded [email
How to promote the progress of project collaboration | community essay solicitation
Uniapp skills - dom display and hiding
QT learning 25 layout manager (4)
Similarities and differences of sessionstorage, localstorage and cookies
Installation impression notes
Implementation of Muduo accept connection, disconnection and sending data
Qt学习24 布局管理器(三)
JVM runtime data area
Global event bus
Too many files with unapproved license
关于回溯问题中的排列问题的思考(LeetCode46题与47题)
Scroll detection of the navigation bar enables the navigation bar to slide and fix with no content
The small project (servlet+jsp+mysql+el+jstl) completes a servlet with login function, with the operation of adding, deleting, modifying and querying. Realize login authentication, prevent illegal log
Solve MySQL 1045 access denied for user 'root' @ 'localhost' (using password: yes)