当前位置:网站首页>Call of addition, subtraction, multiplication and division of integer type only
Call of addition, subtraction, multiplication and division of integer type only
2022-07-25 22:11:00 【Xiaotang blog】
Encapsulate a function of addition, subtraction, multiplication and division to call
include <stdio.h>
// Repackaging function ( Three elements : Return value , parameter list , Function functions )
// Additive encapsulation
int add(int data1,int data2,int data3)
{
int result;
result=data1 + data2+data3;
return result;
}
// Subtraction encapsulation
int sub(int data1,int data2,int data3)
{
int result;
result=data1 - data2- data3;
return result;
}
// Multiplicative encapsulation
int mul(int data1,int data2,int data3)
{
int result;
result=data1 * data2 * data3;
return result;
}
// Division encapsulation
int sub(int data1,int data2,int data3)
{
int result;
result=data1 / data2 / data3;
return result;
}
int main()
{
int x;
int y;
int z;
int res;
printf(" Please enter a number :\n");
scanf("%d",&x);
printf(" Please enter another number :\n");
scanf("%d",&y);
printf(" Please enter another number :\n");
scanf("%d",&z);
res=add(x,y,z);
printf("%d+%d+%d=%d\n",x,y,z,res);
res=sub(x,y,z);
printf("%d-%d-%d=%d\n",x,y,z,res);
res=mul(x,y,z);
printf("%d*%d*%d=%d\n",x,y,z,res);
res=sub(x,y,z);
printf("%d/%d/%d=%d\n",x,y,z,res);
return 0;
}
边栏推荐
- win10搭建flutter环境踩坑日记
- Synchronized and volatile
- Why is the integer type 128 to byte -128
- dovecot 设置邮箱quota
- Summary of function test points of wechat sending circle of friends on mobile terminal
- [51nod1676 undirected graph isomorphism] undirected graph hash [easy to understand]
- 6-17 vulnerability exploitation - deserialization remote command execution vulnerability
- golang : MVC之models
- Basic knowledge in the project
- [hand tear STL] BitSet (bitmap), bloom filter
猜你喜欢

Flex layout

QML module not found

Guiding principles of information security construction

6-17漏洞利用-反序列化远程命令执行漏洞

Wechat card issuing applet source code - automatic card issuing applet source code - with flow main function

Jmeter--- set proxy recording request

虚拟内存与磁盘

Redis基础2(笔记)
![[Fantan] how to design a test platform?](/img/54/5aca54c0e66f8a7c1c3215b8f06613.png)
[Fantan] how to design a test platform?

2 lines of code to generate a solid desktop background
随机推荐
Output Yang Hui triangle with two-dimensional array
【GO基础02】第一个程序
TS:typora代码片段缩进显示异常(已解决)-2022.7.24
All you want to know about interface testing is here
Detailed summary of C language game dual cache to solve the flash screen problem [easy to understand]
Jmeter---设置代理录制请求
Victoriametrics single node of kubernetes
Which is reliable between qiniu business school and WeiMiao business school? Is it safe to open an account recommended by the teacher?
Redis master-slave architecture lock failure problem (master-slave)
如何实现一个App应用程序,限制用户时间使用?
核电站在席卷欧洲的热浪中努力保持安全工作
Having met a tester with three years' experience in Tencent, I saw the real test ceiling
字节跳动技术面都过了,结果还是被刷了,问HR原因竟是。。。
Open source RSS subscriber freshrss
[dinner talk] those things that seem to be for the sake of the company but are actually incomprehensible (2: soft quality "eye edge" during interview)
Why does redisv6.0 introduce multithreading?
C语言:随机生成数+选择排序
What is redis? Briefly describe its advantages and disadvantages
2022 love analysis ― bank digitalization practice report
YUV420 yuv420sp image format "recommended collection"