当前位置:网站首页>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;
}
边栏推荐
- Doxorubicin loaded on metal organic framework MIL-88 DOX | folic acid modified uio-66-nh2 doxorubicin loaded [email
- JVM class loading
- Qt学习18 登录对话框实例分析
- [combinatorics] permutation and combination (examples of combinatorial number of multiple sets | three counting models | selection problem | combinatorial problem of multiple sets | nonnegative intege
- Qt学习24 布局管理器(三)
- JS download files through URL links
- page owner特性浅析
- 怎样删除对象的某个属性或⽅法
- Thrift threadmanager and three monitors
- 信创产业现状、分析与预测
猜你喜欢
Message subscription and publishing
Go language web development series 26: Gin framework: demonstrates the execution sequence of code when there are multiple middleware
allegro,orcad, net alias,port,off-page connector之间的异同点和如何选取
Go: send the get request and parse the return JSON (go1.16.4)
jvm-运行时数据区
[email"/>
Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
[email protected] Nanoparticles) | nano metal organic framework carry"/>
Metal organic framework material zif-8 containing curcumin( [email protected] Nanoparticles) | nano metal organic framework carry
全局事件总线
金属有机骨架MOFs装载非甾体类抗炎药物|ZIF-8包裹普鲁士蓝负载槲皮素(制备方法)
JVM family - overview, program counter day1-1
随机推荐
How to use lxml to judge whether the website announcement is updated
Summary of common error reporting problems and positioning methods of thrift
Go language web development series 28: solve cross domain access of CORS with gin contrib / CORS
Solution to failure or slow downloading of electron when electron uses electron builder to package
Spring cup eight school league
Fabric. JS document
28: Chapter 3: develop Passport Service: 11: define attributes in the configuration file, and then obtain them in the code;
怎样删除对象的某个属性或⽅法
Redis: operation command of string type data
allegro,orcad, net alias,port,off-page connector之间的异同点和如何选取
Common plug-ins for vite project development
C language standard IO function sorting
QT learning 25 layout manager (4)
QT learning 21 standard dialog box in QT (Part 2)
Qt学习22 布局管理器(一)
How to bold text in AI
Selenium browser (1)
Similarities and differences of sessionstorage, localstorage and cookies
JS continues to explore...
QT learning 19 standard dialog box in QT (top)