Question 1 a) Distinguish between the while and do while loops b) Compare and contrast the variables and constants in C++. What are the rules to be followed for identifieZMK? c) Differentiate between nested if-else and switch statement. Question 2 a) Write an entire C++ program that reads a positive integer entered by an interactive user and then prints out all the positive divisors of that integer in a column and in decreasing order. The program should allow the user to repeat this process as many times as the user likes. b) Write a program using arrays to apply the Multiplying of two matrices.
Added by Alvaro W.
Close
Step 1
- The while loop checks the condition before executing the block of code. If the condition is true, the block of code is executed. If the condition is false, the block of code is skipped and the program continues with the next statement outside the Show more…
Show all steps
Your feedback will help us improve your experience
Jennifer Stoner and 69 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a flowchart and C code for a program that does the following: Asks a user the number of years of employment service. Uses an else if statement to display the following messages: - Service greater than 25 years - You receive a gold watch. - Service greater than 15 but less than 25 years - You receive a silver pen. - Service greater than 5 but less than 15 years - You receive an attractive pin. - Service between 0 and 5 years - You receive a pat on the back. Don't forget to add curly brackets with each condition. Feel free to use logical operators in the conditions - this is not required.
Akash M.
thoughtful 1
Florencia C.
#include<iostream> using namespace std; int main() { int a, b; cout << "Enter two positive integers, the first smaller than the second." << endl; cout << "First: "; cin >> a; cout << "Second: "; cin >> b; /* Your code goes here */ return 0; }
Aarya B.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD