jeudi 6 avril 2017

c# programming help DESPERATELY needed

I have been assigned this problem in my intro to programming class and I have absolutely no idea how to do it. It would be extremely appreciated if somebody could help me out!

Here are the instructions:

  • Use the if or the switch statement to make decisions
  • Use the while loop

Instructions: Write a program that takes two positive numbers: Limit and X. The program should count how many numbers between 1 and Limit that are divisible by X without a remainder.

First example: if Limit =100 and X =20, your program should display: 20, 40, 60, 80, 100 There are 5 numbers between 1 and 100 that are divisible by 20 without a remainder

Second example: if Limit =7 and X =2, your program should display: 2, 4, 6 There are 3 numbers between 1 and 7 that are divisible by 2 without a remainder

Third example: if Limit =7 and X =3, your program should display: 3, 6 There are 2 numbers between 1 and 7 that are divisible by 3 without a remainder

Hint: use the mod operator % and a while loop.

Does anyone know how I would go about to create this program?

Thank you, Sarah

Aucun commentaire:

Enregistrer un commentaire