PF-Lec (Program Solutions in C Language).pptx

muhammadanus20 21 views 28 slides Aug 12, 2024
Slide 1
Slide 1 of 28
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28

About This Presentation

C Program


Slide Content

Programming Fundamentals CS-104 – (3+1) Computer Science Muhammad Anus Lecturer, Department of Computer Science and Software Engineering Faculty of Engineering Science , Technology and management, Ziauddin University

Lecture # 05 Selection Statement (If-Then-Else)

Solve Program Examples if, if-else, if-else-if and switch statements 3

Program Example 01 4 Problem Statement: Write a program in C++ that asks you the marks obtained in six different subjects. The program displays the total obtained marks, percentage and the grade as shown in following distribution. Percentage Grade >=85 A+ >=80 and <85 A >=75 and <80 B+ >=70 and <75 B >=65 and <70 C+ >=60 and <65 C >=55 and <60 D+ >=50 and <55 D <50 F

Program Example 01 5

Program Example 01 6

Program Example 01 7

Program Example 02 8 Problem Statement: There are two circular grounds Ground-A and Ground-B. Ground-A is having diameter of 15 meters and Ground-B is having diameter of 20 meters. Mohsin is running in Ground-A and Neetesh is running in Ground-B. Write a computer program that asks the user to input the time taken, in seconds, to complete one compete round of the ground by both the friends and displays who is running faster.

Program Example 02 9

Program Example 02 10

Program Example 02 11

Program Example 03 12 Problem Statement: Write a computer program that asks the user to enter three angles of a triangle. The program displays whether the triangle is right-angle, acute-angle or obtuse-angle.

Program Example 03 13

Program Example 03 14

Program Example 03 15

Program Example 04 16 Problem Statement: Write a computer program that asks the user to enter date of birth and month of birth. The program should display the zodiac star.

Program Example 04 17

Program Example 04 18

Program Example 04 19

Program Example 05 20 Problem Statement: Write a computer program that asks the user to enter any character. The program should whether the entered character is a vowel or a consonant.

Program Example 05 21

Program Example 05 22

Program Example 05 23

Solve Program Examples for and If statements

Program Example 01 Problem Statement: Write a program in C++ that generates and displays all the odd multiples of 5 in the range of 1 and 100.

Program Example 02 Problem Statement: Write a program in C++ that displays the sum of first 10 odd multiples of 3.

Program Example 03 Problem Statement: Write a program in C++ that generates and displays the first N three digit odd numbers. Whereas the number N is provided by the user.

End of lecture
Tags