2023-08-22|閱讀時間 ‧ 約 2 分鐘

C Programming: If Else

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:


分享至
成為作者繼續創作的動力吧!
© 2024 vocus All rights reserved.