{"id":25841933,"url":"https://github.com/courseworks/aut_bp_2024_fall_hw1","last_synced_at":"2026-02-18T07:31:38.736Z","repository":{"id":259499182,"uuid":"878046628","full_name":"courseworks/AUT_BP_2024_Fall_HW1","owner":"courseworks","description":"The first assignment for AUT's Basic Programming course (Fall 2024) focuses on fundamental concepts in C programming. Students will apply conditional statements and basic arithmetic operations to solve practical problems. This assignment is designed to strengthen your understanding of control flow, mathematical computations, and user input/output.","archived":false,"fork":false,"pushed_at":"2024-10-24T18:44:38.000Z","size":60,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T05:32:50.138Z","etag":null,"topics":["amirkabir-university","basic-programming","c-programming","c23"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/courseworks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-24T17:24:23.000Z","updated_at":"2025-02-24T11:41:25.000Z","dependencies_parsed_at":"2024-10-26T09:56:57.735Z","dependency_job_id":null,"html_url":"https://github.com/courseworks/AUT_BP_2024_Fall_HW1","commit_stats":null,"previous_names":["courseworks/aut_bp_2024_fall_hw1"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/courseworks/AUT_BP_2024_Fall_HW1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/courseworks%2FAUT_BP_2024_Fall_HW1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/courseworks%2FAUT_BP_2024_Fall_HW1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/courseworks%2FAUT_BP_2024_Fall_HW1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/courseworks%2FAUT_BP_2024_Fall_HW1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/courseworks","download_url":"https://codeload.github.com/courseworks/AUT_BP_2024_Fall_HW1/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/courseworks%2FAUT_BP_2024_Fall_HW1/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265508336,"owners_count":23779125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amirkabir-university","basic-programming","c-programming","c23"],"created_at":"2025-03-01T05:32:50.596Z","updated_at":"2026-02-18T07:31:38.729Z","avatar_url":"https://github.com/courseworks.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n\u003cstrong\u003eAUT_BP_2024_Fall Homework 1\u003c/strong\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cstrong\u003e Deadline: 11th of Aban - Friday - 23:59 o'clock\u003c/strong\u003e\n\u003c/p\u003e\n\n---\n\n## Instructions\n\n-   **Submission Method**: Submit your `.c` source files via your account at [courses.aut.ac.ir](courses.aut.ac.ir).\n-   **File Naming Convention**: Zip everything and for naming, use this template. `StudentNumber_HW1.zip`\n-   **Plagiarism Notice**: All submissions must be your own work. Plagiarism will result in disciplinary action.\n\n---\n\n## Table of Contents\n\n1. [Sign of a Number](#1-sign-of-a-number)\n2. [Simple Calculator](#2-simple-calculator)\n3. [Triangle Type Checker](#3-triangle-type-checker)\n4. [Quadrant Finder](#4-quadrant-finder)\n5. [Currency Denomination Calculator](#5-currency-denomination-calculator)\n6. [Distance Between Two Points](#6-distance-between-two-points)\n\n---\n\n## 1. Sign of a Number\n\n### Description\n\nWrite a C program that determines whether a given number is **positive**, **negative**, or **zero**. The program should prompt the user to enter a number and then display a message indicating the sign of the number.\n\n### Example Input/Output\n\n**Example 1**\n\n```\n\nEnter a number: 25\nThe number is positive.\n\n```\n\n**Example 2**\n\n```\n\nEnter a number: -7.5\nThe number is negative.\n\n```\n\n**Example 3**\n\n```\n\nEnter a number: 0\nThe number is zero.\n\n```\n\n### Edge Cases and Pitfalls\n\n-   **Zero**: Ensure your program correctly identifies zero as neither positive nor negative.\n-   **Floating-Point Numbers**: The program should handle both integers and floating-point numbers.\n-   **Invalid Input**: You may assume that the user enters a valid number. Handling invalid inputs is not required for this assignment.\n\n---\n\n## 2. Simple Calculator\n\n### Description\n\nCreate a C program that functions as a simple calculator. The program should:\n\n-   Prompt the user to enter two numbers.\n-   Ask the user to choose an arithmetic operation: **addition (+)**, **subtraction (-)**, **multiplication (\\*)**, or **division (/)**.\n-   Perform the chosen operation and display the result.\n\n### Example Input/Output\n\n**Example 1**\n\n```\n\nEnter first number: 10\nEnter second number: 5\nEnter an operator (+, -, *, /): -\nResult: 10 - 5 = 5\n\n```\n\n**Example 2**\n\n```\n\nEnter first number: 7\nEnter second number: 0\nEnter an operator (+, -, *, /): /\nError: Division by zero.\n\n```\n\n### Edge Cases and Pitfalls\n\n-   **Division by Zero**: The program should check for division by zero and display an appropriate error message.\n-   **Invalid Operator**: If the user enters an invalid operator, the program should inform the user.\n-   **Input Validation**: You can assume that the user enters valid numbers and a valid character for the operator.\n\n---\n\n## 3. Triangle Type Checker\n\n### Description\n\nWrite a C program that determines the type of a triangle based on the lengths of its three sides. The program should:\n\n-   Prompt the user to enter the lengths of three sides.\n-   Determine if the sides form a valid triangle.\n-   If valid, identify the triangle as:\n    -   **Equilateral**: All sides are equal.\n    -   **Isosceles**: Two sides are equal.\n    -   **Scalene**: All sides are different.\n\n### Example Input/Output\n\n**Example 1**\n\n```\n\nEnter the lengths of the three sides: 5 5 5\nThe triangle is equilateral.\n\n```\n\n**Example 2**\n\n```\n\nEnter the lengths of the three sides: 7 7 5\nThe triangle is isosceles.\n\n```\n\n**Example 3**\n\n```\n\nEnter the lengths of the three sides: 3 4 5\nThe triangle is scalene.\n\n```\n\n**Example 4**\n\n```\n\nEnter the lengths of the three sides: 1 2 3\nThe lengths do not form a valid triangle.\n\n```\n\n### Edge Cases and Pitfalls\n\n-   **Triangle Inequality Theorem**: Ensure that the sum of any two sides is greater than the third side.\n-   **Invalid Triangles**: If the sides do not form a valid triangle, the program should inform the user.\n-   **Equal Sides**: Be careful when checking for equality due to floating-point precision.\n\n---\n\n## 4. Quadrant Finder\n\n### Description\n\nDevelop a C program that determines the quadrant of a point in a 2D coordinate system based on its **x** and **y** coordinates. The program should:\n\n-   Prompt the user to enter the **x** and **y** coordinates.\n-   Determine and display the quadrant in which the point lies:\n    -   **Quadrant I**: x \u003e 0 and y \u003e 0\n    -   **Quadrant II**: x \u003c 0 and y \u003e 0\n    -   **Quadrant III**: x \u003c 0 and y \u003c 0\n    -   **Quadrant IV**: x \u003e 0 and y \u003c 0\n-   If the point lies on an axis or at the origin, indicate that as well.\n\n### Example Input/Output\n\n**Example 1**\n\n```\n\nEnter the x-coordinate: 4\nEnter the y-coordinate: -5\nThe point is in Quadrant IV.\n\n```\n\n**Example 2**\n\n```\n\nEnter the x-coordinate: 0\nEnter the y-coordinate: 0\nThe point is at the origin.\n\n```\n\n**Example 3**\n\n```\n\nEnter the x-coordinate: -3\nEnter the y-coordinate: 0\nThe point lies on the X-axis.\n\n```\n\n**Example 4**\n\n```\n\nEnter the x-coordinate: 0\nEnter the y-coordinate: 6\nThe point lies on the Y-axis.\n\n```\n\n### Edge Cases and Pitfalls\n\n-   **Axis Handling**: Correctly identify points that lie exactly on the X-axis or Y-axis.\n-   **Origin**: Ensure that the point (0, 0) is identified as the origin.\n\n---\n\n## 5. Currency Denomination Calculator\n\n### Description\n\nCreate a C program that calculates the minimum number of banknotes required to represent a given amount of money in dollars. The denominations available are:\n\n-   **$20 bills**\n-   **$10 bills**\n-   **$5 bills**\n-   **$1 bills**\n\nThe program should:\n\n-   Prompt the user to enter an amount in dollars (integer value).\n-   Calculate and display the minimum number of each type of bill needed.\n\n### Example Input/Output\n\n**Example 1**\n\n```\n\nEnter an amount in dollars: 93\nMinimum number of banknotes:\n$20 bills: 4\n$10 bills: 1\n$5 bills: 0\n$1 bills: 3\n\n```\n\n**Example 2**\n\n```\n\nEnter an amount in dollars: -5\nInvalid amount. Please enter a non-negative integer.\n\n```\n\n### Edge Cases and Pitfalls\n\n-   **Negative Amounts**: The program should handle negative inputs by displaying an error message.\n-   **Zero Amount**: If the amount is zero, the program should indicate that no bills are needed.\n-   **Non-integer Values**: You can assume the user will enter an integer amount.\n\n---\n\n## 6. Distance Between Two Points\n\n### Description\n\nWrite a C program that calculates the distance between two points in a 2D plane. The program should:\n\n-   Prompt the user to enter the coordinates of the first point (**x₁**, **y₁**).\n-   Prompt the user to enter the coordinates of the second point (**x₂**, **y₂**).\n-   Calculate and display the distance between the two points using the distance formula:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://latex.codecogs.com/svg.latex?\\text{Distance}=\\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\" /\u003e\n\u003c/p\u003e\n\n### Example Input/Output\n\n**Example 1**\n\n```\n\nEnter the coordinates of the first point (x1 y1): 3 4\nEnter the coordinates of the second point (x2 y2): 7 1\nThe distance between the two points is: 5.000\n\n```\n\n**Example 2**\n\n```\n\nEnter the coordinates of the first point (x1 y1): -2.5 0\nEnter the coordinates of the second point (x2 y2): 0 3.5\nThe distance between the two points is: 4.301\n\n```\n\n### Edge Cases and Pitfalls\n\n-   **Same Points**: If both points are the same, the distance should be zero.\n-   **Negative Coordinates**: The program should handle negative values correctly.\n-   **Floating-Point Precision**: Consider formatting the output to three decimal places for readability.\n\n---\n\n## Submission Guidelines\n\n-   **Code Style**: Your code should be well-indented and commented where necessary.\n-   **Compilation**: Ensure your code compiles without errors or warnings.\n-   **Testing**: Test your programs with multiple inputs to ensure correctness.\n-   **Academic Integrity**: Discussing ideas is allowed, but sharing code is not. Submissions will be checked for plagiarism.\n\n---\n\n## Contact\n\nIf you have any questions regarding the homework, feel free to reach out:\n\n-   **Teaching Assistant**: Seyyed Mohammad Hamidi\n-   **Telegram**: [t.me/rsmhamidi](https://t.me/rsmhamidi)\n-   **Telegram Group**: [t.me/AUT_BP_Fall_2024](https://t.me/AUT_BP_Fall_2024)\n-   **Github**: [github.com/smhamidi](https://github.com/smhamidi)\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./Resource/Say_Hello_To_Other_Errors.webp\" alt=\"Say Hello To Other Errors\" style=\"width: 40%;\"\u003e\n\u003c/p\u003e\n\n**Best Regards, [Hamidi](https://github.com/smhamidi)**\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcourseworks%2Faut_bp_2024_fall_hw1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcourseworks%2Faut_bp_2024_fall_hw1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcourseworks%2Faut_bp_2024_fall_hw1/lists"}