Professional Documents
Culture Documents
To be familiar with the control structures type: repetition (looping) and if else statement.
Learning Outcomes: At the end of the session, the students are able:-
int main(){
int num;
cout<<"Enter a number:"<<endl;
cin>>num;
if(num %2==0){
cout<<"The number"<<num<<"is even"<<endl;
}
if(num %2!=0){
cout<<"The number"<<num<<"is odd"<<endl;
}
system("pause"); //freeze your output window,it will print out "press any key
to continue"
int main(){
int y=0;
while(y<=10)
{
cout<<"The no is: "<<y<<endl;
y++;
}
system("pause"); //freeze your output window,it will print out "press any key
to continue"
int main(){
int count=1;
int A,B=0;
3- If user entered character between 'a' to 'g' or number between 1 to 10.789, please display
"Level 1".
4- If user entered character between 'h' to 'm' and number between 11 to 20.789, please
display "Level 2".
5- If user entered other characters or other numbers, please display "Level 3".
Question 2
By using 1 while loop, construct a C++ program to display the following output;