Search code examples
c#mathsqrt

I have 2 problems with sqrt I solved the first one how can I solve it the second one like the first one? it is fairly diffucult then other


I know in this site homework or assigment stuff is not really welcome but I need help. I have an homework it contains 2 questions I already finished first one because it was easy. The second one isn't that much easy it is the same type of question but I think second one is harder then first one way too much. here is the first one I did.

first question: first question

this is the answer for that question

Double a = 0;

            for(int i=1; i<100; i+=2)
            {

                a += (Math.Sqrt(i * (i + 1)));
            }
            Console.WriteLine("Cevap= " + a);
            Console.ReadKey();

it was fairly easy and simple

second question (NOTE: there is an error in the last term; 49*100 is incorrect, it should be 99*100): second question

they are a bit different but I think it's doable with the same codes but have to change a little bit.

now I don't want to an answer that answer the question but an answer to teach me how to do it. I know it's a bit arrogant to ask my homework here but I ask your help nonetheless.


Solution

  • The series seems wrong as one side there are 25 terms and on the other side is 50 terms
    Assuming that the last term of the series is sqrt(99*100)
    This will solve the problem

    Double a = 0;
    int j = 50;
    for(int i=1; i<=100; i+=2){   
           j++;         
           a += (Math.Sqrt(i * j));
         }
                
    Console.WriteLine("Cevap= " + a);
    Console.ReadKey();
    

    Hope this solves your problem but if you try on with last term as sqrt(49*100) it will simply not be possible.