问题描述
如果一个人x向公司支付RS1000 / - 如果x加入3个人说x1,x2,x3这三个人每个人向公司支付1000,那么x将获得该金额的10%。然后x1加入另一个3名成员说x4,x5,x6现在他们也向公司支付1000,然后x1将获得该金额的10%(即x4,x5,x6)。然后x将获得x1金额的10%。喜欢这个过程会继续。我为第一个人做这个会得到多少钱。
------------------------ -------------------------------------------------- --------------------------------------
static void main( )
{
Console.writeline(输入no.of levels);
Int l = convert.toint32(console.readline( ));
双和= 0;
For(int i = 1; i< = l; i ++)
{
Double a = math.pow(3,i);
Double b = math.pow(10,i);
Double value = 1000 * (a / b);
总和=总和+值;
}
Console.writeline(结果是+总和);
Console.readline();
}
-------------------- -------------------------------------------------- -----------------------------------------
但是我想在每个级别每个人都会得到多少钱
If a person x pays RS1000/- to a company.If x joins 3 persons say x1,x2,x3 these 3 persons each person pay 1000 to the company then x will get 10% of that amount.Then x1 joins another 3 members say x4,x5,x6 now also they pay 1000 to company then x1 will get 10% of that amount(i.e x4,x5,x6).then x will get 10% of x1 amount. like this process will continue.I do this for first person will get how much money.
----------------------------------------------------------------------------------------------------------------
staticvoid main()
{
Console.writeline("enter no.of levels");
Int l=convert.toint32(console.readline());
Double sum=0;
For(int i=1;i<=l;i++)
{
Double a=math.pow(3,i);
Double b=math.pow(10,i);
Double value=1000*(a/b);
Sum=sum+value;
}
Console.writeline("Result is "+sum);
Console.readline();
}
---------------------------------------------------------------------------------------------------------------
But i want at each level each person will get how much money
推荐答案
这篇关于控制台应用程序的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!