Write C# program

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write C# program

Post by answerhappygod »

Write C# program
Write C Program 1
Write C Program 1 (132.49 KiB) Viewed 34 times
(a) (8%) Write a C# method (function) primeNumber that checks if a positive integer k you input is a prime number. (b) (6%) Write C# program (with Main method) that uses your primeNumber method, to print out all the prime numbers from 2 until 200 with 8 prime numbers printed in a row (note 200 is NOT a prime number, so this means until the largest prime number <200). Enhance your program to also print out how many prime numbers are <200. (c) (12%) Generalize your program of part (b) to take an integer n> 1 from you that calculates all the prime numbers from 2 up to n. (so n = 200 as in part (b) is a particular case of part (c)) Since there may be too many prime numbers printed when n is big, customize your program this way: When n < 500, print prime numbers starting from 2, until n, 8 in a row. Also, print out the total number of such prime numbers When n >= 500, print out just the total number of such prime numbers (but do NOT print out prime numbers 8 in a row). Test your program with three integers, n = 400, n = 1,000, and a third integer of your choice.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply