Severity: Notice
Message: Trying to access array offset on value of type bool
Filename: view/view.php
Line Number: 33
Severity: Notice
Message: Trying to access array offset on value of type bool
Filename: view/view.php
Line Number: 33
Severity: Notice
Message: Trying to access array offset on value of type bool
Filename: view/view.php
Line Number: 33
#include <iostream> using namespace std; int main() { int n; double suma=0; cout << "Podaj ile skladnikow chcesz dodac :"; cin>>n; for (int i=1;i<=n;i++) { 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 cout << suma << endl; } cout << "Suma "<<n<<" skladnikow to :"<<suma; return 0; }
Title | Name | Language | UNIX | When |
---|---|---|---|---|
Re: Re: suma Nepera (tym razem działa) | Karlos | cpp | 1479151543 | 7 Years ago. |