Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- //1/(1*3)+1/(2*5)+1/(3*7)+...+1/(m*(2*m+1))
- float vsota(int vrednost);
- int main() {
- int m;
- float rez;
- printf("Unesite vrednost m: ");
- scanf("%d",&m);
- rez = vsota(m);
- printf("Vrednost: %f\n",rez);
- system("PAUSE");
- return 0;
- }
- float vsota(int vrednost){
- int i;
- float resenje=0.0;
- float suma;
- for(i = 1;i<=vrednost;i++){
- suma = 1.0/(i*(2.0*i+1.0));
- resenje += suma;
- }
- return resenje;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement