Jump to content
Hertz

[Programare]Adnunare

Recommended Posts

Posted

Se da urmatoarea secventa de numere :

10000

? (3n+2) / (2n+3)

n = 1

Care este suma totala a celei de-a 3-a zecimala din fiecare numar.Daca e numar intreg,adauga 0,deoarece nu va afecta rezultatul.

Exemplu :

1.4378125 2.4932175

7 + 3 = 10

Posted

87112

#include<iostream.h>
#include<math.h>

void main()
{
unsigned long s=0;
double x;
for(long i=1;i<=10000;i++)
{
x=double(i);
s+=long(double((3*x+2)/(2*x+3))*1000)%10;
}
cout<<s;
}

//editeaza titlul.

poate e cu o microsecunda mai rapid (n-1)/(2x+3) :D

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...