Homework Assignment - Week 2
Course: Structured Programming in C
Topic: Data Types, Structure of C Program, Input/Output
Instructions:
• Write programs in C with proper comments.
• Follow the standard structure of a C program (header files, main function, declaration,
logic, output).
• Submit `.c` files with meaningful filenames.
• For each problem, write one solution using compile-time initialization and another using
run-time initialization (if applicable).
Assignment Problems
1. Area of a Rectangle
- Given length and breadth (both compile-time and run-time).
2. Temperature Conversion
- Convert temperature from Celsius to Fahrenheit.
- Formula: F = (C × 9/5) + 32
3. Simple Interest Calculation
- Formula: SI = (P × R × T) / 100
- Take P, R, and T both by compile-time and run-time.
4. Average of Three Marks
- Calculate average marks of 3 subjects, display as float value with 2 decimal places.
Extra Challenge (Optional)
• Write a program to calculate the total and average of marks for 5 students, where marks
are entered at run-time. Use meaningful variable names.
• Write a program to swap the values of two variables without using a third variable, using
run-time input.
Submission Guidelines:
• Create a Word file and include your full name at the top.
• For each question:
1. Write the question statement.
2. Write an Algorithm/ Flowchart
3. Add your program code.
4. Insert a screenshot of the program’s output.
• Save the file as a PDF.
• Upload the PDF using the shared Google Form.
• Deadline: Sunday 17th August.