Lab 1
Lab 1
C/C++ Programming
Lab 1
Branching statements
_____________________________________________________________________________________
1
INTERNATIONAL UNIVERSITY
I. Objectives
Students are required to review the theory of the topics before the lab time.
Exercise 1
Output:
Input an integer: 15
15 is an odd integer
Exercise 2
_____________________________________________________________________________________
2
INTERNATIONAL UNIVERSITY
Output:
Exercise 3
For Example:
Output:
Exercise 4
Write a C program to input radius of a circle from user and find diameter, circumference,
and area of the circle.
For example:
_____________________________________________________________________________________
3
INTERNATIONAL UNIVERSITY
Exercise 5
Write a C program that calculate the roots of the second order equation:
2
ax +bx +c=0
For example:
Output:
Enter the Values of a : 1
Enter the Values of b : -4
Enter the Values of c : 3
Write a C program that calculate the total payment of Taxi service, in which:
Example
Output:
Exercise 7
_____________________________________________________________________________________
4
INTERNATIONAL UNIVERSITY
Write a C program to read student’s name, student’s ID and marks of three subjects
(Literature, Math and English) and calculate the total, average and division.
Average ≥60: A
48 ≤Average ¿60: B
For Example
Output:
THE END
_____________________________________________________________________________________
5
INTERNATIONAL UNIVERSITY
Useful Operators
_____________________________________________________________________________________