Académique Documents
Professionnel Documents
Culture Documents
Declarations
num X, Y
C++ Program
#include<iostream>
using namespace std;
X = 10
Y=5
int main()
{ int X, Y;
Output X, Y
X=X1
Y=Y+5
while
X >= 6
X = 10;
Y = 5;
do
{
cout<< X<<endl<<Y<<endl;
X = X 1;
Y = Y + 5;
} while (X >= 6);
return 0;
}
N
Stop
Page 1 of 6
Computer Fundamentals
2.) Create a flowchart/C++ program that will generate the following number series:
1, 1, 2, 3, 5, 8, 13, 21, 34, and 55
Flowchart
Start
C++ Program
#include <iostream>
using namespace std;
Declarations
num X, Y, Sum
int main()
{ int X, Y, Sum;
X=0
Y=1
Sum = 1
X = 0;
Y = 1;
Sum = 1;
do
{
cout<< Sum<<endl;
Sum = X + Y;
X = Y;
Y = Sum;
} while (Sum <= 55);
return 0;
}
Output Sum
Sum = X + Y
X=Y
Y = Sum
while
Sum <= 55
N
Stop
Page 2 of 6
Computer Fundamentals
3.) Create a flowchart/C++ program that will generate the following number series:
1, 2, 4, 7, 11, 16, 22, 29, 37, and 46
Flowchart
Start
C++ Program
Declarations
num X, Y
#include <iostream>
using namespace std;
int main()
{ int X, Y;
X = 1;
Y = 1;
do
{
cout<< Y<<endl;
Y = Y + X;
X = X + 1;
} while (Y <= 46);
return 0;
}
X=1
Y=1
Output Y
Y=Y+X
X=X+1
while
Y <= 46
N
Stop
Page 3 of 6
Computer Fundamentals
4.) Create a flowchart/C++ program that will input five numbers and output how many of
the numbers entered are odd or even.
Flowchart
A
Start
ctr = ctr + 1
Declarations
Num number
while
ctr <= 5
ctr = 1
ctre = 0
ctro = 0
N
B
Input number
Stop
If
number % 2 == 0
ctre = ctre + 1
N
ctro = ctro + 1
C++ Program
#include <iostream>
using namespace std;
int main()
{ int num, ctr=1, ctro=0, ctre=0;
do
{
cin>> num;
if (num % 2 == 0)
ctre = ctre + 1;
else
ctro = ctro + 1;
ctr = ctr + 1;
} while (ctr <= 5);
cout<< ctro<<endl<< ctre<<endl;
return 0;
}
Page 4 of 6
Computer Fundamentals
5.) Create a flowchart/C++ program that will input five numbers and output how many of
the numbers entered are positive or negative.
Flowchart
A
Start
ctr = ctr + 1
Declarations
num number, ctr, crtp, ctrn
while
ctr <= 5
ctr = 1
ctrp =0
ctrn = 0
N
B
Input number
Stop
If
number > 0
ctrp = ctrp + 1
N
ctrn = ctrn + 1
C++ Program
#include <iostream>
using namespace std;
int main()
{
int num, ctr=1, ctrp=0, ctrn=0;
do
{
cin>> num;
if (num > 0)
ctrp = ctrp + 1;
else
ctrn = ctrn + 1;
ctr = ctr + 1;
} while (ctr <= 5);
cout<<ctrp<<endl<<ctrn<<endl;
return 0;
}
Page 5 of 6
Computer Fundamentals
6.) Create a flowchart/C++ program that will input 10 alphabetic characters and output
how many of the characters entered were vowels and consonants. Display an invalid
input message if the character entered is not alphabetic and ask the user to input a valid
character.
7.) Create a flowchart/ C++ program that will input 5 numbers and output the highest
number entered.
8.) Create a flowchart/ C++ program that will input 6 score for quizzes (0-100).
Eliminate the lowest quiz and compute and output the average of the five remaining
quizzes.
Page 6 of 6