Question

Compute the average kids per family Note that the integers should be type cast to doubles #include Kiostream 2 using namespace std 4 int maino int numb idSAE 13 6 int numKids8 e 4; int numKidsc 55 int nunfamilies double 0.01 10 Your answer 11 Average kids per family: avgkids endl a
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
using namespace std;

int main() {
   int numkidsA=1;
   int numkidsB=4;
   int numkidsC=5;
   int numfamily=3;
   double averagekids=0.0;
averagekids=(double)   (numkidsA+numkidsB+numkidsC)/numfamily;
cout<<averagekids;
   return 0;
}

output:

3.33333

Add a comment
Know the answer?
Add Answer to:
Compute the average lids per family. #include <iostream> using namespace std; int main() {int numKids a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT