0% found this document useful (0 votes)
25 views1 page

Assignment3 ProgrammingFundamentals SP25

The document outlines the instructions for Assignment 3 in Programming Fundamentals, requiring students to write C++ programs for specified problems. It emphasizes the use of control structures, loops, and user-defined functions, along with proper coding practices such as commenting and indentation. The assignment includes two specific tasks: finding prime numbers within a range and creating a calculator with a menu-driven interface for basic arithmetic operations.

Uploaded by

vendelduver17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

Assignment3 ProgrammingFundamentals SP25

The document outlines the instructions for Assignment 3 in Programming Fundamentals, requiring students to write C++ programs for specified problems. It emphasizes the use of control structures, loops, and user-defined functions, along with proper coding practices such as commenting and indentation. The assignment includes two specific tasks: finding prime numbers within a range and creating a calculator with a menu-driven interface for basic arithmetic operations.

Uploaded by

vendelduver17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Assignment 3

Programming Fundamentals
Instructions:
• Write the C++ programs for the given problems.
• Ensure proper use of if, if-else, if-else-if-else, switch, and nested if-else statements and for
loops, while loops and do-while loops and user-defined functions wherever applicable.
• Use cin for input and cout for output.
• Comment on each step of your code.
• Ensure the proper use of indentation and brackets in the programs.
• Submit your solution as a .cpp file with name as SAP-ID_Name_Assignment3.cpp with all of
the questions’ codes written inside of it, each code running individually on their own and
add a comment on the top as the question number.
Total Marks: 10
Submission Deadline: 11:59 p.m., June 14, 2025.
Q1: Write a program that takes two positive integers from the user: a start and an end value.
You must:
• Use a function isPrime(int n) that returns true if n is a prime number.
• Loop through all numbers in the given range and display only the prime numbers using the
function.
Also, count how many primes were found and display the total at the end.
Q2: Create a calculator that inputs two numbers and presents the user with the following menu:
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Each operation must be implemented in a separate function which accepts two numbers and
returns the result. The program should keep showing the menu until the user chooses Exit.
NOTE: For division, check for division by zero and display an error if attempted.

You might also like