C Project
C Project
1. Brief Introduction:
2. Aim of Project:
The aim of this program is to take input from the user regarding the attendance of
students in a class and then summarize the attendance by displaying the total number
of students, number of students present and absent.
Develop programming skills: The program requires the use of various programming
constructs such as loops, conditional statements, and input/output functions to achieve
the desired functionality. Implement user input validation: The program checks for
valid user input by validating if the user has entered either 'y' or 'n'. Apply basic
arithmetic and logical operations: The program uses arithmetic and logical operators
such as addition, subtraction, and logical OR to calculate the total number of students
present and absent.
4. Uses of C language:
5. Applications of C Language:
Fast
Portability
Function-Rich library
Dynamic memory management
Modularity with structured language
Mid-level programming language
Pointers with the use of pointers in C, you can directly interact with memory
Recursion C language provides the feature of recursion
6. Advantages:
Portable language
Structured programming language
Powerful and efficient language
Building block for many other programming language
Quality to extend itself
7. Disadvantages:
Run-time checking
Constructor or destructor
Low-level of abstraction
Concept of name space
No strict type checking
In this code, we use a for loop to iterate over each student, from 1 to n. Inside the
loop, we prompt the user to enter whether the student is present or absent. We use the scan
function to read a single character from the user input, and store it in the attendance variable.
We then use an if-else statement to check whether the user entered 'y' or 'n', and
update the present count or absent count variable accordingly. If the user entered anything
other than 'y' or 'n', we print an error message and decrement the loop variable I so that the
current iteration can be repeated.
Finally, we print a summary of the attendance, including the total number of students,
the number of students who are present, and the number of students who are absent.
OUTPUT: