Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- using namespace std;
- int main()
- {
- float x,y;
- int n;
- do {
- cout<<"Unesi broj: ";
- cin>>x;
- y += x;
- n++;
- if ( x == 0 ) {
- n--;
- y = y / n;
- break;
- }
- } while (x!=0);
- cout<<"Uneseno je "<<n<<" brojeva."<<" Srednja vrijednost je: "<<y;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement