Facebook
From Karl, 7 Years ago, written in C++.
">

A PHP Error was encountered

Severity: Notice

Message: Trying to access array offset on value of type bool

Filename: view/view.php

Line Number: 33

from

A PHP Error was encountered

Severity: Notice

Message: Trying to access array offset on value of type bool

Filename: view/view.php

Line Number: 33

- view diff
Embed
Download Paste or View Raw
Hits: 494
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     double suma=0;
  9.     cout << "Podaj ile skladnikow chcesz dodac :";
  10.     cin>>n;
  11.      for (int i=1;i<=n;i++)
  12.     {
  13.         suma=suma + (double)1/i; //bez "(double)" program operuje na liczbach całkowitych, więc wynik 1/i mógł wynosić 1 dla x=1 i 0 dla x>1
  14.         cout << suma << endl;
  15.     }
  16.  
  17.     cout << "Suma "<<n<<" skladnikow to :"<<suma;
  18.     return 0;
  19. }

Replies to Re: suma Nepera (tym razem działa) rss

Title Name Language When
Re: Re: suma Nepera (tym razem działa) Karlos cpp 7 Years ago.