Programming Assignment Questions (10)
1. Explain the difference between an algorithm and a flowchart, then write an
algorithm and draw a flowchart to calculate the area of a rectangle.
2. Write an algorithm and draw a flowchart to determine whether a number is even or
odd.
3. Write a C++ program using if...else to determine whether a student has passed (50
and above) or failed.
4. Write a C++ program using a switch statement to display the day of the week based
on a number (1-7).
5. Write a program using a for loop to display numbers from 1 to 20 and their sum.
6. Write a program using a while loop to repeatedly accept numbers until the user
enters 0, then display the total sum.
7. Create a function named calculateSquare(int n) that returns the square of a number.
Demonstrate its use in main().
8. Write a function named findLargest(int a,int b,int c) that returns the largest of three
numbers.
9. Declare an array of 10 integers. Write a program to input the values and display the
largest and smallest values.
10. Write a program that stores five student marks in an array, calculates the average
mark using a loop, and displays the result.