C Programming: If Else

更新 發佈閱讀 1 分鐘

Exercise 1: Even or odd

Prompt the user to enter an integer. Determine whether a given number is even or odd


Exercise 2: Grading System

Write a program that takes a student's score as input and prints their corresponding grade based on the following grading scale:

90 and above: A

80 - 89: B

70 - 79: C

60 - 69: D

Below 60: F


Exercise 3: Calculator Program

Write a simple calculator program that takes two numbers and an operator (+, -, *, /) as input and performs the corresponding arithmetic operation.


Code Examples:


留言
avatar-img
邵的沙龍
3會員
5內容數
邵的沙龍的其他內容
2023/08/27
C Programming: If-Else, For Loop Exercises
2023/08/27
C Programming: If-Else, For Loop Exercises
2023/08/26
C program: For Loop
2023/08/26
C program: For Loop
2023/08/26
C programming : Switch
2023/08/26
C programming : Switch
看更多
你可能也想看
Thumbnail
在 vocus 與你一起探索內容、發掘靈感的路上,我們又將啟動新的冒險——vocus App 正式推出! 現在起,你可以在 iOS App Store 下載全新上架的 vocus App。 無論是在通勤路上、日常空檔,或一天結束後的放鬆時刻,都能自在沈浸在內容宇宙中。
Thumbnail
在 vocus 與你一起探索內容、發掘靈感的路上,我們又將啟動新的冒險——vocus App 正式推出! 現在起,你可以在 iOS App Store 下載全新上架的 vocus App。 無論是在通勤路上、日常空檔,或一天結束後的放鬆時刻,都能自在沈浸在內容宇宙中。
Thumbnail
市場經驗拉長之後,很多投資人都會遇到同一個問題:不是方向看錯,而是部位太集中個股,常常跟大趨勢脫節。 早年的台股環境,中小股非常吃香,反而權值股不動,但QE量化寬鬆後,特別是疫情之後,後疫情時代,鈔票大量在股市走動,這些大資金只能往權值股走,因此早年小P的策略偏向中小型個股,但近年AI興起,高技術
Thumbnail
市場經驗拉長之後,很多投資人都會遇到同一個問題:不是方向看錯,而是部位太集中個股,常常跟大趨勢脫節。 早年的台股環境,中小股非常吃香,反而權值股不動,但QE量化寬鬆後,特別是疫情之後,後疫情時代,鈔票大量在股市走動,這些大資金只能往權值股走,因此早年小P的策略偏向中小型個股,但近年AI興起,高技術
Thumbnail
進入選擇敘述語法了。常用的選擇敘述語法,弄懂了就運用自如。
Thumbnail
進入選擇敘述語法了。常用的選擇敘述語法,弄懂了就運用自如。
追蹤感興趣的內容從 Google News 追蹤更多 vocus 的最新精選內容追蹤 Google News