flowchart, create.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section: Chapter Questions
Problem 7PP
icon
Related questions
Question

flowchart, create.

//SumAndProduct.cpp-This program computes
//sums and products
//Input : Interactive
//Output : computed sum and product
#include<iostream>
#include<string>
void sum(int a ):
void products(int a):
using namespace std;
int main()
{
int number;
cout<<"Enter a positive integer or 0 to quit:":
cin>>number;
while(number!=0)
{
l/calling sum function
sum(number):
I/calling products function
products(number):
cout<<"Enter a positive integer or 0 to quit:":
cin>>number;
return 0;
}
//sum function definition
void sum(int a)
{
int sum=0; //Initialising sum value
for(int i=1;i<=a;i++)
{
sum+ei;
lladding the whole numbers upto a
}
cout<<"sum of numbers is :"<<sum<<"\n":
void products(int a)
{
int productSum=1://Initialising productSum value
for(int i=1;i<=a;i++)
productSum*=i; //product of all whole numbers upto a
cout<<"product sum is:"<<productSum<<"\n";
}
Transcribed Image Text://SumAndProduct.cpp-This program computes //sums and products //Input : Interactive //Output : computed sum and product #include<iostream> #include<string> void sum(int a ): void products(int a): using namespace std; int main() { int number; cout<<"Enter a positive integer or 0 to quit:": cin>>number; while(number!=0) { l/calling sum function sum(number): I/calling products function products(number): cout<<"Enter a positive integer or 0 to quit:": cin>>number; return 0; } //sum function definition void sum(int a) { int sum=0; //Initialising sum value for(int i=1;i<=a;i++) { sum+ei; lladding the whole numbers upto a } cout<<"sum of numbers is :"<<sum<<"\n": void products(int a) { int productSum=1://Initialising productSum value for(int i=1;i<=a;i++) productSum*=i; //product of all whole numbers upto a cout<<"product sum is:"<<productSum<<"\n"; }
Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Data Binding
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage