Write a program using pseudocode to create four functions add(a,b) to add a and b then return the result, similarly sub(a,b), mult(a,b), div(a,b) to perform mathematical operations. Provide a menu to choose which calculation to perform. Parameters a and b are inputs from user.
Given two numbers X and Y, create a program that determines the difference between X and Y using if-else. If X - Y is negative, compute R = X + Y; if X - Y is zero, compute R = 2X + 2Y; and if X - Y is positive, compute R = X * Y. Print the values of X, Y, and R.
1. What is loop as used in programming?
2. What are the 3 types of loops?
3. What are the 3 types of control structures?
4. How do you break a loop?
5. How do loops work?
6. What is the while, for, foreach and Do While loop syntax?
7. What is control structures?
8. Using algorithms, pseudocode and flow chart explain all
types of loop found in C++.
9. With at least two real world examples, explain at least three
application of each type of loop in C++.
Write an algorithm to delete a node at end of the doubly linked list and create the logic for the same
Write algorithm to perform insert and delete operations in an linear queue and implement the logic for the same
Proof of surjective in linear transformation
Write an algorithm that finds the middle, or median, value of three distinct integers. The input for this algorithm falls into six groups; describe them. What is the best case for your algorithm? What is the worst-case?
The population of a town A is less than the population of town B.However, the population of
algorithmoutputs after how many years the population of town A will be greater than or equal to
flowchartthat prompts the user to enter the population and growth rate of each town. The
Population of town A =5000, growth rate of town A = 4%, populationof town B = 8000, and
town A is growing faster than the population of town B. Write algorithm usingpseudocodeand
the population of town B and the populations of both the towns at that time. (A sample input is:
growth rate of town B =2%)
how can i different between for loop and while loop
Write algorithm using pseudocode and flowchart that uses while loops to perform the
following steps:
i. Prompt the user to input two integers: firstNum and secondNum note that firstNum
must be less than secondNum.
ii. Output all odd numbers between firstNum and secondNum.
iii. Output the sum of all even numbers between firstNum and secondNum.
iv. Output the numbers and their squares between firstNum and secondNum.
v. Output the sum of the square of the odd numbers between firstNum and secondNum.
b. Redo Exercise (a) using for loops.
c. Redo Exercise (a) using do. . .while loops.