├── Submissions ├── Readme.md └── Dhiraj_Kumar_AI_16 │ ├── Normal_Dist.c │ ├── Poission_Dist.c │ └── Binomial_Dist.c └── README.md /Submissions/Readme.md: -------------------------------------------------------------------------------- 1 | ## Please submit your assignment files here 2 | -------------------------------------------------------------------------------- /Submissions/Dhiraj_Kumar_AI_16/Normal_Dist.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(){ 4 | int x; 5 | float m,s,p; 6 | float pi=3.141,e=2.7183; 7 | printf("Enter the value of mean:"); 8 | scanf("%f",&m); 9 | printf("Enter the value of standard deviation:"); 10 | scanf("%f",&s); 11 | printf("Enter the value of random variable:"); 12 | scanf("%d",&x); 13 | float a=pow(e,-0.5*((x-m)/s)*((x-m)/s)); 14 | float b=pow(2*pi, 1/2); 15 | p=(1/(s*b))*a; 16 | printf("The normal distribution for given random variable is %f",p); 17 | } -------------------------------------------------------------------------------- /Submissions/Dhiraj_Kumar_AI_16/Poission_Dist.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int factorial( int p){ 4 | int fact=1; 5 | for(int i=1;i<=p;i++){ 6 | fact=fact*i; 7 | } 8 | return fact; 9 | 10 | } 11 | int main(){ 12 | int r; 13 | printf("Enter the value of r:"); 14 | scanf("%d",&r); 15 | float m; 16 | printf("Enter the value of mean (m):"); 17 | scanf("%f",&m); 18 | float e=2.71828; 19 | float a=pow(e,-m); 20 | float b=pow(m,r); 21 | int c=factorial(r); 22 | float f=(a*b)/c; 23 | printf("The poission distribution for the random variable %d is %f",r,f); 24 | } -------------------------------------------------------------------------------- /Submissions/Dhiraj_Kumar_AI_16/Binomial_Dist.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int factorial( int p){ 4 | int fact=1; 5 | for(int i=1;i<=p;i++){ 6 | fact=fact*i; 7 | } 8 | return fact; 9 | 10 | } 11 | int main(){ 12 | int n,r; 13 | float p,q; 14 | printf("Enter the probability of success:\n"); 15 | scanf("%f",&p); 16 | printf("The probability of success is:%f\n",p); 17 | q=1-p; 18 | printf("The probability of failure is:%f\n",q); 19 | printf("Enter the total number of sample space:\n"); 20 | scanf("%d",&n); 21 | printf("Enter the value of random variable:\n"); 22 | scanf("%d",&r); 23 | float a=pow(p,r); 24 | float b=pow(q,(n-r)); 25 | int c=factorial(n); 26 | int d=factorial(r); 27 | int e=factorial(n-r); 28 | float pro=(c/(d*e))*a*b; 29 | printf("The probability of required random variable is:%f",pro); 30 | 31 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Binomial Distribution Program - Assignment Submission Repository 2 | 3 | Welcome to the **Binomial Distribution Program** assignment submission repository! This repository is dedicated to hosting and managing the assignment submissions for the **Binomial Distribution Program** from students. Please read the guidelines below carefully to ensure that your submission is valid and complete. 4 | 5 | ## Table of Contents 6 | 1. [Objective](#objective) 7 | 2. [Assignment Requirements](#assignment-requirements) 8 | 3. [Submission Guidelines](#submission-guidelines) 9 | 4. [File Naming Convention](#file-naming-convention) 10 | 5. [Programming Language Suggestions](#programming-language-suggestions) 11 | 6. [How to Submit](#how-to-submit) 12 | 7. [Repository Structure](#repository-structure) 13 | 14 | ## Objective 15 | 16 | The purpose of this assignment is to implement the **Binomial Distribution Program** using C/C++ to demonstrate your understanding of probability distributions and statistical programming. This assignment will evaluate your ability to apply theoretical concepts to practical implementation. 17 | 18 | ## Assignment Requirements 19 | 20 | 1. **Program Description:** 21 | - You are required to write a program that computes the **Binomial Distribution** for given inputs. 22 | - The program should take two inputs: the number of trials (`n`) and the probability of success (`p`). 23 | - You should compute the probability for all possible values of the random variable, from `0` to `n`, and display the result. 24 | 25 | 2. **Expected Output:** 26 | - The output should list the probability distribution for the number of successes, i.e., for each value from `0` to `n`. 27 | 28 | 3. **Mathematical Formula:** 29 | - The binomial probability mass function (PMF) is given by: 30 | P(X = k) = C(n, k) * p^k * (1 - p)^(n - k) 31 | 32 | Where: 33 | 34 | n is the number of trials 35 | p is the probability of success on a single trial 36 | k is the number of successes 37 | C(n, k) is the binomial coefficient, calculated as n! / (k! * (n - k)!) 38 | 39 | ## Submission Guidelines 40 | 41 | In order to maintain consistency and ensure proper evaluation, please adhere to the following guidelines: 42 | 43 | 1. **Submission Deadline:** 44 | - All assignments must be submitted before the provided deadline. 45 | 46 | 2. **Individual Submissions:** 47 | - This is an individual assignment. Each student must submit their own solution. 48 | 49 | 3. **Valid Format:** 50 | - Only submissions with valid file names and formats will be considered. 51 | - Files must be submitted in **C or C++** format (.c or .cpp extensions). 52 | 53 | ## File Naming Convention 54 | 55 | All students are **required** to follow the naming convention for the submitted file. This will help in identifying each submission properly. 56 | 57 | - **Format:** `Name_Class_RollNo_Branch.extension` 58 | - Example: `JohnDoe_Class10_12345_CSE.cpp` 59 | 60 | ### Explanation: 61 | - **Name:** Your full name (use CamelCase, i.e., first letter of each name capitalized, no spaces). 62 | - **Class:** Your current class/grade. 63 | - **RollNo:** Your unique roll number provided by the institution. 64 | - **Branch:** Your branch of study. 65 | - **Extension:** The file extension based on the language used (either `.c` or `.cpp`). 66 | 67 | Ensure that the file is named correctly, otherwise it may not be accepted. 68 | 69 | ## Programming Language Suggestions 70 | 71 | While it is suggested to use **C or C++** to complete this assignment, you are free to use either language based on your preference: 72 | 73 | 1. **C Language:** Use `.c` as the file extension. 74 | 2. **C++ Language:** Use `.cpp` as the file extension. 75 | 76 | Both languages are well-suited for mathematical and statistical problems like the binomial distribution, and they offer efficient libraries for handling such computations. 77 | 78 | ## How to Submit 79 | 80 | 1. **Fork the Repository:** 81 | - First, fork this repository to your own GitHub account. 82 | 83 | 2. **Clone the Repository:** 84 | - Clone the repository to your local machine using the following command: 85 | ``` 86 | git clone https://github.com/YourUsername/Binomial-Distribution-Assignment.git 87 | ``` 88 | 89 | 3. **Create a New Folder for Your Submission:** 90 | - Inside the repository, create a new folder using your **full name** as the folder name. 91 | - Place your assignment file inside this folder. 92 | 93 | 4. **Push Your Changes:** 94 | - After adding your file, commit the changes and push them to your forked repository. 95 | ``` 96 | git add . 97 | git commit -m "Added submission for John Doe" 98 | git push origin main 99 | ``` 100 | 101 | 5. **Create a Pull Request (PR):** 102 | - Once the file has been successfully uploaded, create a pull request to the main repository for review. 103 | 104 | 6. **Submission Review:** 105 | - Your submission will be reviewed, and any feedback will be provided through GitHub comments. 106 | 107 | ## Repository Structure 108 | 109 | The repository structure should follow this format: 110 | ``` 111 | ├── README.md 112 | ├── JohnDoe_Class10_12345_CSE.cpp 113 | ├── JaneSmith_Class10_12346_CSE.c 114 | ├── Submission-Guidelines.txt 115 | ... 116 | ``` 117 | 118 | - Each student will have their individual file listed in the root directory. 119 | 120 | ## Common Issues 121 | 122 | - **Incorrect File Naming:** Ensure your file follows the naming convention exactly, including the use of CamelCase for your name. 123 | - **Wrong File Extension:** Make sure your file is submitted in either `.c` or `.cpp` format. 124 | - **Late Submissions:** No late submissions will be accepted unless prior approval has been granted. 125 | 126 | --------------------------------------------------------------------------------