Homework 1 CIS 260 Winter XXXXXXXXXXLab 5 Functions Reminder – you cannot use the Internet to find a solution – problem solving is your job Function reminders: • Name with a NOUN since they return a...

.


Homework 1 CIS 260 Winter 2022 Lab 5 Functions Reminder – you cannot use the Internet to find a solution – problem solving is your job Function reminders: • Name with a NOUN since they return a single value • Make sure they accomplish a single task – for example, don’t calculate a number and display it in one function. 1. A prime number is a number other than 1 that is divisible only by 1 and itself. (Example of prime numbers: 2, 3, 5, 7, ...). Write a program that asks the user for a positive integer. The program will then print out all prime numbers from 1 to that positive integer in a single MessageBox or a ListBox – don’t display each number in its own control. • You can concatenate numbers together into a string with & Write (and call) a function IsPrime to check out if an integer is prime or not. • The function takes an Integer as an argument and returns a Boolean. • You would call it: If IsPrime(Number) Then … 2. A perfect number is a number where all of its proper divisors add up to the number itself. Examples of perfect numbers: 6 is a perfect number. Proper divisors of 6 are 1, 2, and 3. 1 + 2 + 3=6 28 is a perfect number. Proper divisors of 28 are 1, 2, 4, 7, 14. 1 + 2 + 4 + 7 + 14 = 28. Write a program that asks the user for a positive integer. The program will print all perfect numbers from 1 to that positive integer. Write a Boolean function IsPerfect to check out perfectness of an integer. Don’t forget to program an Exit button. A clear button would be cool too. 3. Write a program that is going to ask the user for the range of years and print out all leap years in that 5range 5 to a line. Use appropriate headings. Exit button, Clear button, of course. Using MSDN or your textbook (no other Internet sources) check to see if Visual Basic has a built-in function to determine if a date is a leap year. If so, use that function to determine which dates are leap years.
Feb 17, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here