Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
Write a program that ask for user input from 5 to 9 then calculate the average
Write a program that ask for user input from 5 to 9 then calculate the average
✍: Guest
#include "iostream.h" int main() { int MAX = 4; int total = 0; int average; int numb; for (int i=0; i<MAX; i++) { cout << "Please enter your input between 5 and 9: "; cin >> numb; while ( numb<5 || numb>9) { cout << "Invalid input, please re-enter: "; cin >> numb; } total = total + numb; } average = total/MAX; cout << "The average number is: " << average << "\n"; return 0; }
2012-01-27, 2714👍, 0💬
Popular Posts:
How can you raise custom errors from stored procedure ? The RAISERROR statement is used to produce a...
How can we know the number of days between two given dates in PHP? Simple arithmetic: <?php $...
Can you explain why your project needed XML? Remember XML was meant to exchange data between two ent...
Where Is the Submitted Form Data Stored? - PHP Script Tips - Processing Web Forms When a user submit...
How do we assign page specific attributes ? Page attributes are specified using the @Page directive.