While Loops and Flow Control

  1. Write program to report if a number is even or odd.
  2. Write a program where the user enters two numbers N and D. The program then prints out "Yes" if N is evenly divided by D, otherwise it prints "No"
  3. Using a while write a program where the user enters a positive number N, and the program prints out all the numbers from 1 to N. Does it work for 1?
  4. Wrirte a program where the user enters two numbers N and D. The program then prints out all the number from 1 to N that are divided by D.
  5. What is a prime number? How can we tell if a number is prime? What about 0? 1? 2?
  6. Write a program where the user enters a number N, and the program either prints "N is prime" or "N is not prime".
  7. How good is you program? What can we do to improve it?
  8. Write a program that prints all the prime numbers between 1 and N.
Topic revision: r1 - 2019-09-12 - JimSkon
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback