Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Tài Liệu Phổ Thông
Sáng kiến kinh nghiệm
Lecture Introduction to computer and programming - Lecture No 8
tailieunhanh - Lecture Introduction to computer and programming - Lecture No 8
The contents of this chapter include all of the following: Example programs – printf, scanf; decision control structure; relational operator in C; if statement; if-else statement; nested if else statement; logical operator in C; conditional operator. | CSC103: Introduction to Computer and Programming Lecture No 8 Previous Lecture Example programs – printf, scanf Decision control structure Relational operator in C if statement if-else statement Today’s lecture outline Nested if else statement Logical operator in C Conditional operator Nested if else It is possible to write an entire if-else with either the if statement block or else statement block Nested if else flowchart Start Display “Enter either 1 or 2” Read x Display “you entered other than 1 or 2” Go to program x == 1 Yes No x == 2 No Yes Display “you entered 1” End Display “you entered 2” Forms of if statement Cont. Logical Operators && (logical AND) true if both conditions are true if ( gender == 1 && age >= 65 ) senior++; || (logical OR) true if either of condition is true if (semesterAvg >= 90 || finalExam >=90 ) printf("Student grade is A“); Cont. ! (logical NOT, logical negation) Returns true when its condition is false, & vice versa if ( !( grade == 20 ) ) printf(“hello world“); Alternative: if ( grade != 20 ) printf(“hello world“); False ! if (True) True ! if (False) Logical Operators Sample Program -1 To calculate the division Input: marks of 5 different subjects Rules Percentage above or equal to 60 - First division Percentage between 50 and 59 - Second division Percentage between 40 and 49 - Third division Percentage less than 40 – Fail Solution Nested if-else Logical operators Go to Program Go to Program Sample Program -2 A company insures its drivers in the following cases: If the driver is married If the driver is unmarried, male & above 30 years of age If the driver is unmarried, female & above 25 years of age If the marital status, gender and age of the driver are the inputs, write a program to determine whether the driver is to be insured or not. Flowchart Go to Program without logical operator Go to Program with logical operator (ms is married) OR (ms is unmarried and g is male and age is > 30) OR (ms is unmarried and g is . | CSC103: Introduction to Computer and Programming Lecture No 8 Previous Lecture Example programs – printf, scanf Decision control structure Relational operator in C if statement if-else statement Today’s lecture outline Nested if else statement Logical operator in C Conditional operator Nested if else It is possible to write an entire if-else with either the if statement block or else statement block Nested if else flowchart Start Display “Enter either 1 or 2” Read x Display “you entered other than 1 or 2” Go to program x == 1 Yes No x == 2 No Yes Display “you entered 1” End Display “you entered 2” Forms of if statement Cont. Logical Operators && (logical AND) true if both conditions are true if ( gender == 1 && age >= 65 ) senior++; || (logical OR) true if either of condition is true if (semesterAvg >= 90 || finalExam >=90 ) printf("Student grade is A“); Cont. ! (logical NOT, logical negation) Returns true when its condition is false, & vice versa if ( !( grade == 20 ) ) .
Ngọc Hoàn
68
1
pptx
Báo lỗi
Trùng lắp nội dung
Văn hóa đồi trụy
Phản động
Bản quyền
File lỗi
Khác
Upload
Tải xuống
đang nạp các trang xem trước
Bấm vào đây để xem trước nội dung
Tải xuống
TÀI LIỆU LIÊN QUAN
Pro PHP and iQuery
401
104
0
Principles of Programming Languages
166
128
0
Lecture Programming languages (2/e): Chapter 12b - Tucker, Noonan
14
98
0
Discovering Computers - Chapter 13: Programming Languages and Program Development
51
100
0
Beginning Algorithms
591
111
0
PHP Game Programming
377
114
0
LAND OF LISP
508
81
0
Lecture Programming languages (2/e): Chapter 14a - Tucker, Noonan
18
86
0
Lecture Programming languages (2/e): Chapter 15a - Tucker, Noonan
20
86
0
Lecture Programming languages (2/e): Chapter 12d - Tucker, Noonan
38
92
0
TÀI LIỆU XEM NHIỀU
Một Case Về Hematology (1)
8
461880
55
Giới thiệu :Lập trình mã nguồn mở
14
22702
61
Tiểu luận: Tư tưởng Hồ Chí Minh về xây dựng nhà nước trong sạch vững mạnh
13
10903
530
Câu hỏi và đáp án bài tập tình huống Quản trị học
14
10075
446
Phân tích và làm rõ ý kiến sau: “Bài thơ Tự tình II vừa nói lên bi kịch duyên phận vừa cho thấy khát vọng sống, khát vọng hạnh phúc của Hồ Xuân Hương”
3
9539
104
Ebook Facts and Figures – Basic reading practice: Phần 1 – Đặng Tuấn Anh (Dịch)
249
8298
1126
Tiểu luận: Nội dung tư tưởng Hồ Chí Minh về đạo đức
16
8245
423
Mẫu đơn thông tin ứng viên ngân hàng VIB
8
7867
2220
Đề tài: Dự án kinh doanh thời trang quần áo nữ
17
6704
253
Vật lý hạt cơ bản (1)
29
5780
85
TỪ KHÓA LIÊN QUAN
Sáng kiến kinh nghiệm
Programming languages
Computing systems
C programming language
Introduction to computer
Operating system software
Introduction to computer
experience in programming
software engineering
programming languages
computer programming
programming tips
programming experience
code programming
design tips
programming documentation
programming skills
the Ruby programming document
methods Ruby programming language
Lecture Programming languages
Ngôn ngữ lập trình
Imperative programming
Imperative languages
Dynamic allocation
Discovering Computers
Program Development
Low Level Languages
Procedural Languages
Object Oriented Programming Languages
java programming language C + +
C programming
computer software
computer engineering
computer programming language PHP
Functional programming
Functional programming models
Lambda calculus
Logic programming
Logic programming in prolog
Prolog program elements
Scripting languages
Lecture Introduction to computing
Bài giảng Nhập môn máy tính
Introduction to computing
Role of programming languages
Android Programming
Java
programming code
Procedural abstraction
Data structures
Matrix multiplication
Object oriented programming
Abstract data types
The object model
Object oriented language
Represent polynomials
Symbolic differentiation
Mixed language
Scripting language
Semantics of clite
List comprehensions
Practical aspects of prolog
Natural language processing
Event driven programming
Event driven control
Event handling
Java applet
Tic Tac Toe
TÀI LIỆU MỚI ĐĂNG
Sáng tạo trong thuật toán và lập trình với ngôn ngữ Pascal và C# Tập 2 - Chương 4
47
248
1
30-04-2024
Quy Trình Canh Tác Cây Bông Vải
8
110
0
30-04-2024
Báo cáo nghiên cứu khoa học " HÃY LÀM CHO HUẾ XANH HƠN VÀ ĐẸP HƠN "
6
119
0
30-04-2024
Color Atlas of Ophthamology
165
87
0
30-04-2024
báo cáo hóa học:" Quality of data collection in a large HIV observational clinic database in sub-Saharan Africa: implications for clinical research and audit of care"
7
92
0
30-04-2024
Giáo trình báo chí điều tra part 4
44
100
0
30-04-2024
Giáo dục kỹ năng sống mầm non: Làm gì khi bị trấn lột - Có kẻ lạ mặt rình bám theo bé
4
83
0
30-04-2024
báo cáo khoa học: "Ultrasound-guided diagnostic breast biopsy methodology: retrospective comparison of the 8-gauge vacuum-assisted biopsy approach versus the spring-loaded 14-gauge core biopsy approach"
15
94
0
30-04-2024
Báo cáo nghiên cứu khoa học " Đại hội XVI thông qua điều lệ Đảng cộng sản Trung Quốc những sửa đổi bổ sung mới "
4
114
0
30-04-2024
IT Audit: EMC’s Journey to the Private Cloud
13
93
0
30-04-2024
TÀI LIỆU HOT
Mẫu đơn thông tin ứng viên ngân hàng VIB
8
7867
2220
Giáo trình Tư tưởng Hồ Chí Minh - Mạch Quang Thắng (Dành cho bậc ĐH - Không chuyên ngành Lý luận chính trị)
152
5775
1386
Ebook Chào con ba mẹ đã sẵn sàng
112
3772
1232
Ebook Tuyển tập đề bài và bài văn nghị luận xã hội: Phần 1
62
5331
1136
Ebook Facts and Figures – Basic reading practice: Phần 1 – Đặng Tuấn Anh (Dịch)
249
8298
1126
Giáo trình Văn hóa kinh doanh - PGS.TS. Dương Thị Liễu
561
3515
644
Tiểu luận: Tư tưởng Hồ Chí Minh về xây dựng nhà nước trong sạch vững mạnh
13
10903
530
Giáo trình Sinh lí học trẻ em: Phần 1 - TS Lê Thanh Vân
122
3692
525
Giáo trình Pháp luật đại cương: Phần 1 - NXB ĐH Sư Phạm
274
4070
516
Bài tập nhóm quản lý dự án: Dự án xây dựng quán cafe
35
4135
480
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.