找到三个整数的中间值 [英] Finding middle value of three integers

查看:49
本文介绍了找到三个整数的中间值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编写代码来查找j是否为中间值?

并查看所有三个值是否相等?



我尝试过:



int i = 1;

int j = 2;

int k = 3;





j> = i

j< = k;

how do i write code to find if j is the middle value?
and to see if all three values are equal?

What I have tried:

int i = 1;
int j = 2;
int k = 3;


j >= i
j <= k;

推荐答案

引用:

如何编写代码来查找j是否为中间值?

how do i write code to find if j is the middle value?



Take一张纸和一支铅笔,然后手工解决问题。你没有得到魔法的答案,所以想一想,然后用机械的方式记下这些步骤,这基本上是你的算法,然后翻译成代码。



我们不做你的家庭作业。

HomeWork不会在乞求别人做你的工作时测试你的技能,它会让你思考并帮助你的老师检查你对你所学的课程以及你应用它们时遇到的问题。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

你的任何失败都会帮助你了解什么有效,什么无效,被称为'试错'学习。

所以,试一试,重读课程并开始工作。如果您遇到特定问题,请展示您的代码并解释这个问题,我们可能会提供帮助。


Take a sheet of paper and pencil, then solve the problem by hand. You didn't get the answer by magic, so think about it and write down the steps in a mechanical way, this is basically your algorithm, then translate to code.

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.


这篇关于找到三个整数的中间值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆