By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,260 Members | 1,340 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,260 IT Pros & Developers. It's quick & easy.

harmonic , geometric, arithmetic program

P: 4
How do I write a program using the harm,geo,arith formula but requires user input?? I know I cin>> but its suppose to accept user input including all numbers up to 900. How would I write that formula?? ( count / ((1/1)+(1/2)+(1/3).....................) I would have to keep going forever?? I am using a while loop ... Please help?? anyone :) Thank you
Nov 7 '06 #1
Share this Question
Share on Google+
3 Replies

P: 85
What exactly do you want the program to do?
Nov 8 '06 #2

P: 4
using namespace std;
int main()

double result=0,top,below,i;
cout<<"enter 2 numbers:";
return 0;

I wrote a program like this I don't know if this is your wish but you should explain what you want exactly
Nov 8 '06 #3

Expert Mod 2.5K+
P: 4,677
If you're just supposed to accept all numbers up to and including 900, but through user input, it sounds like you want

Expand|Select|Wrap|Line Numbers
  1. // while statement that keep input between 1 and 900
  2. while ((inputNum > 900) || (inputNum < 1)) {    
  3.  cin >> inputNum;
  4. }
Nov 8 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.