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 慶祝推出 App,舉辦 2026 全站慶。推出精選內容與數位商品折扣,訂單免費與紅包抽獎、新註冊會員專屬活動、Boba Boost 贊助抽紅包,以及全站徵文,並邀請你一起來回顧過去的一年, vocus 與創作者共同留下了哪些精彩創作。
Thumbnail
vocus 慶祝推出 App,舉辦 2026 全站慶。推出精選內容與數位商品折扣,訂單免費與紅包抽獎、新註冊會員專屬活動、Boba Boost 贊助抽紅包,以及全站徵文,並邀請你一起來回顧過去的一年, vocus 與創作者共同留下了哪些精彩創作。
Thumbnail
文章探討近期銀行對於房貸申請的態度轉變,特別是財力一般的客戶面臨的困難,並介紹「國峰厝好貸」作為民間二胎房貸的選項。分析其優缺點,包括不受央行禁令影響、審核快速、核准率高等優勢,以及較高的利率(7%-16%)和民間借貸的風險。作者提醒讀者,若非走投無路,應謹慎評估,並建議諮詢專業人士。
Thumbnail
文章探討近期銀行對於房貸申請的態度轉變,特別是財力一般的客戶面臨的困難,並介紹「國峰厝好貸」作為民間二胎房貸的選項。分析其優缺點,包括不受央行禁令影響、審核快速、核准率高等優勢,以及較高的利率(7%-16%)和民間借貸的風險。作者提醒讀者,若非走投無路,應謹慎評估,並建議諮詢專業人士。
Thumbnail
進入選擇敘述語法了。常用的選擇敘述語法,弄懂了就運用自如。
Thumbnail
進入選擇敘述語法了。常用的選擇敘述語法,弄懂了就運用自如。
追蹤感興趣的內容從 Google News 追蹤更多 vocus 的最新精選內容追蹤 Google News