Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1: Using C++ Write a program that finds and prints all of the prime numbers between 3 and 100. A prime number is a

Question 1: Using C++ Write a program that finds and prints all of the prime numbers between 3 and 100. A prime number is a number that can only be divided by one and itself (i.e., 3, 5, 7, 11, 13, 17, . . .). One way to solve this problem is to use a doubly-nested loop. The outer loop can iterate from 3 to 100, while the inner loop checks to see whether the counter value for the outer loop is prime. One way to decide whether the number n is prime is to loop from 2 to n 1; if any of these numbers evenly divides n, then n cannot be prime. If none of the values from 2 to n 1 evenly divide n, then n must be prime. (Note that there are several easy ways to make this algorithm more efficient.)

Question 2: Using C++

Write a program that calculates the total grade for N classroom exercises as a per- centage. The user should input the value for N followed by each of the N scores and totals. Calculate the overall percentage (sum of the total points earned divided by the total points possible) and output it as a percentage. Sample input and output are shown as follows: How many exercises to input? 3 Score received for exercise 1: 10 Total points possible for exercise 1: 10 Score received for exercise 2: 7 Total points possible for exercise 2: 12 Score received for exercise 3: 5 Total points possible for exercise 3: 8 Your total is 22 out of 30, or 73.33%.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

using signal flow graph

Answered: 1 week ago