简体   繁体   English

C#中的交叉乘法

[英]Cross multiplication in c#

I've two scenarios where I have to find result based on parameters(by doing cross multiplication). 在两种情况下,我必须根据参数(通过交叉乘法)查找结果。 Those scenarios are as following: 这些情况如下:

For example, 例如,

Scenario - 1: 场景-1:

int previousConceptCount = 100
int currentConceptCount = 20
int previousTime = 10
int currentTime = ?

Que: If 100 concepts take 10 mins to complete than how much time 20 concepts will take?
Ans: 
currentTime = (currentConceptCount * previousTime) / previousConceptCount //Works fine

//Mathematical calculation which I've added in code.  
  100     10
 ----- = -----  ==> x = (20(currentConceptCount) * 10(previousTime)) / 100(previousConceptCount)
  20       x  

Scenario - 2: 场景-2:

int previousConceptCount = 10
int currentConceptCount = 100
int previousDocumentCount = 100
int currentDocumentCount = 100
int previousTime = 10
int currentTime = ?

    Que: If 10 concepts with 100 documents take 10 mins than how much time 100 concepts with 100 documents will take?
Ans: 
    currentTime = ?

How to calculate currentTime in this kind of scenario. 在这种情况下如何计算currentTime I'll always have conceptCounts(both previous and current) and documentCounts(both previous and current) and based on that I've to find time. 我将始终拥有conceptCounts(both previous and current)documentCounts(both previous and current)并以此为基础寻找时间。 I don't know what math formula will be needed or let me put it this way, I do not know how to calculate in this scenario. 我不知道将需要什么数学公式,或者我这样说,我不知道在这种情况下如何计算。

Any suggestions? 有什么建议么?

您只需要将概念乘以文档即可:

(20(currentConceptCount*currentDocumentCount) * 10(previousTime)) / 100(previousConceptCount*previousDocumentCount)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM