// This
#include <iostream>
using namespace std;
int main()
{
int numCount, total;
double average;
cout ≪ "How many numbers do you want to average? ";
cin ≫ numCount;
for (int count = 0; count < numCount; count++)
{
int num;
cout ≪ "Enter a number: ";
cin ≫ num;
total += num;
count++;
}
average = total / numCount;
cout ≪ "The average is ≪ average ≪ endl ;
return 0;
}
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Starting Out with C++ from Control Structures to Objects (8th Edition)
Additional Engineering Textbook Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Artificial Intelligence: A Modern Approach
Database Concepts (8th Edition)
Modern Database Management (12th Edition)
Starting Out with C++: Early Objects (9th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
- Find errors / syntax error. Write line numberarrow_forwardNonearrow_forward2 ii) String character = "Leia"; String planet //L1 = "Alderaan"; //L2 if (character.equals ("Rey")) { planet } //L3 = "Hoth"; //L4 else { planet } "Jakku"; //L5 + planet); //L6 %3D %3D System.out.println(character + at Answer to question 2 ii): Complete the dry run table (you may not need all rows): : LINE character planet character.equals(“Rey")? print Options -arrow_forward
- #include using namespace std3; int main() { int x-6; int y=103; int z=0; int q=1; Z+= X-- -ys q*=++z+y; cout<arrow_forward8. Determine the value of variable num1, num2 and num3 at the end of the following code. int product(int A, int *B){ *B += 1; A *= *B; return A; } int main(){ int num1 = 2, num2 = 3, num3; num3 = product(num2, &num1); O A. num1 = 3, num2 = 3, num3 = 9 num1 = 2, num2 = 3, num3 = 9 num1 = 2, num2 = 3, num3 = 6 %3D D. num1 = 3, num2 = 2, num3 = 6 B.arrow_forwardInt number[-9]; true False The general form of (Compound if) is: If (condition); {statmenet1; } else {statmenet1; } * true False Program to print numbers from 100 to 10. # includeusing namespace std; int main ( ) { intn; for (n=100; n>9; n++) cout << n << ", ";} * true Falsearrow_forward#include #include #include #include using namespace std; int main (){ const double PI = 3.14159265359; return 0; }arrow_forward#include #include #include #include #include using namespace std; int main (){ const double PI = 3.14159265359; return 0; }arrow_forward#include<stdio.h>#include<stdlib.h> int cent50=0;int cent20=0;int cent10=0;int cent05=0; void calculatechange(int* change){if(*change>0){if(*change>=50){*change-=50;cent50++;}else if(*change>=20){*change-=20;cent20++;}else if(*change>=10){*change-=10;cent10++;}else if(*change>=05){*change-=05;cent05++;}calculatechange(change);}}void printchange(){if(cent50)printf("\n50cents:%d coins",cent50);if(cent20)printf("\n20cents:%d coins",cent20);if(cent10)printf("\n10cents:%d coins",cent10);if(cent05)printf("\n05cents:%d coins",cent05);cent50=0;cent20=0;cent10=0;cent05=0;}void takechange(int* change){scanf("%d",change);getchar();}int main(){int change=0;int firstinput=0;while(1){if(!firstinput){printf("\nEnter the amount:");firstinput++;}else{printf("\n\nEnter the amount to continue or Enter -1 to…arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage