1. Factorial Calculator Write a program that prompts the user to enter a number, n. The program should then use a while loop to calculate the factorial of n (i.e. n! = n * (n-1) * (n-2) * ... * 1). The program should display the factorial to the user. Input: 5 Output: 120 2. Positive Number Average Write a program that prompts the user to enter a series of numbers, terminated by a negative number. The program should then use a while loop to calculate the average of the positive numbers entered by the user. The program should display the average to the user. Input: 5 10 -3
5/11/2023章節 📚 第一章-緒論 第二章-揭開資料表示的面紗 第三章-變數與位址 第四章-動態記憶體管理 第五章-程式碼與指令系統 第六章-函數與函數呼叫 第七章-多層級儲存系統 第八章-作業系統互動
1/2/2022or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up