cse
cse
Objectives:
To gain knowledge about different types of operators.
To practice operations of these operators.
To gather knowledge to evaluate expressions.
Introduction:
The lab report focuses on key fundamentals of C programming that form the core of
writing efficient programs. It explores the sqrt() function from the math.h library,
used to find the square root of a given number, including its syntax and required
header file.
The report also examines conditional statements like if and else, which control the
program's execution flow based on certain conditions. It explains how these
statements evaluate conditions and execute different code blocks accordingly.
Additionally, the report covers the process of swapping values between two variables,
a common programming operation. It provides a step-by-step approach using a
temporary variable to accomplish this task.
The report delves into character functions from the ctype.h header file, such as
toupper() and tolower() for case conversion, and isalpha(), isdigit(), and isspace() for
character validation and categorization.
Furthermore, it discusses arithmetic operators in C, including addition, subtraction,
multiplication, division, and modulus. It explains the order of operations (PEMDAS)
and covers increment, decrement, and compound assignment operators essential for
mathematical calculations.
By covering these fundamental concepts, the report aims to establish a solid
foundation for understanding and applying them in various algorithms and problem-
solving scenarios within C programming.
Problem 1
Write your first program to demonstrate the working of arithmetic operators in
C.
Conclusion:
The lab exercises effectively demonstrated key programming principles in C,
enhancing students' understanding of arithmetic operations, conditional logic, and
character manipulation. By solving practical problems and implementing various
programs, students developed a solid foundation in C programming, preparing them
for more advanced topics and complex problem-solving scenarios. These exercises
not only improved coding skills but also fostered a deeper appreciation for the
systematic approach required in programming. Overall, the lab sessions were
successful in achieving their educational objectives, providing a strong basis for
future learning and application in the field of computer science and engineering.