Lab report 1
Lab report 1
Student Details
Name ID
OBJECTIVES/AIM
1. To perform basic arithmetic operations on two user-provided numbers.
2. To calculate the area and circumference of a circle given its radius.
3. To convert a length value in centimeters to meters and kilometers.
4. To calculate the area of a rectangle using user input for dimensions.
5. To calculate the area of a square using the user-provided side length.
6. To convert a temperature value from Celsius to Fahrenheit.
7. To convert a temperature value from Fahrenheit to Celsius.
8. To calculate the total and average marks of five subjects using user input.
PROCEDURE / ANALYSIS / DESIGN
Algorithm for Problem 8:
1. Start.
2. Take input for the marks of five subjects.
3. Calculate the total by summing all five marks.
4. Calculate the average by dividing the total by 5.
5. Display the total and average marks.
6. End.
IMPLEMENTATION
1. Write a C program to enter two numbers and perform all arithmetic operations.
4. Write a C program to calculate the area of a rectangle (user input for height and
width).
5. Write a C program to calculate the area of a square (user input for side length).
8. Write a C program to enter marks of five subjects and calculate total and average
marks
TEST RESULT / OUTPUT
Problem:1
Input:29,6
Output:
Sum:35
Subtraction:23
Multiplication:174
Division: 4.000000
Modulus:5
Problem:2
Input:7
Output:
Area:153.94
Circumference: 43.98
Problem:3
Input:12345
Output:
Meters:123.45
Kilometers: 0.12
Problem:4
Input:10,5
Output:
Area: 50.00
Problem:5
Input:6
Output:
Area: 36.00
Problem:6
Input:25
Output:
Temperature in Fahrenheit: 77.00
Problem:7
Input:98.6
Output:
Temperature in Celsius: 37.00
Problem:8
Input:85,90,78,88,92
Output:
Total:433.00
Average :86.60
ANALYSIS AND DISCUSSION
• Analysis: All programs functioned correctly for the given test cases.
• What went well? Efficient use of C programming concepts like loops, arithmetic
operations, and conditionals.
• Trouble spots: Handling edge cases like division by zero and negative inputs required
additional considerations.
• Difficult parts: Logical errors during unit conversions and managing data input.
• Liked about the assignment: It provided diverse scenarios to apply programming skills.
• Learned from assignment: Mastery of arithmetic operations, input handling, and
structured problem-solving.
• Mapping of objectives: All objectives were successfully achieved.
SUMMARY:
This lab report covers a series of eight problems, showcasing the application of basic C
programming concepts such as input handling, arithmetic operations, loops, and conditional
statements. Each problem presented unique challenges, from unit conversions and temperature
calculations to area computations and mark processing. The implementation emphasized both
functionality and robustness, ensuring accurate results for a variety of inputs. This assignment
enhanced programming skills, provided a structured approach to problem-solving, and reinforced
the importance of handling edge cases effectively.